When I publish the KmlToLayer as below, I can publish the Group Layer as a map service. Gp Server publishes group layer parameter type as GpString and can display it as Map Service.
But when I try to do the same output with Arcpy as follows, the lyr file is only recognized as a file and the result map service is empty.
result_gl = arcpy.mapping.ListLayers(mxd, "GroupLayer", df)
result_group_layer_path = arcpy.env.scratchWorkspace + "\\" + "scratch.lyr"
arcpy.SaveToLayerFile_management(result_gl , result_group_layer_path)
# Only this one adds result layer to display others not.
# arcpy.SetParameter(1, result_gl)
# arcpy.SetParameter(1, arcpy.mapping.Layer(result_group_layer_path))
When I publish this with "View results with a map service option" , the output parameter is as follows not as a map service.
What is the difference between the KmlToLayer model above and the my ArcPy model outputs?
What should I do in order for the ArcGIS server to display the result lyr file (group layer) as a map service?