publish hosted map image layer

777
1
10-26-2018 07:30 AM
Mannus_Etten
New Contributor III

I want to publish a map from an arcgis pro projectfile with Python as map image layer in portal

so the step is to create a sddraft file and continue with a sd-file and publish.

all done and is working for feature layers

but for my map image layer with later wms capabilities python returns the message

2018-10-26 13:46:15,360 Unable to publish item.

2018-10-26 13:46:15,360 This service definition file was created for an ArcGIS Server site and must be uploaded directly to an ArcGIS Server site through ArcGIS Server Manager or ArcMap.

 

publishing of the sd-file in the arcgis server manager fails as well

I did some analysis of the sddraft from python and arc gis pro. they differ quit a lot and even type definitions of certain elements in the xml differ. There are a few elements which are typed as Boolean in the arcgis pro sd-draft file while they are strings in the python sd-draft file.

my code is as follow:

if createFilesWMS:

    project = loadProject(projectFileLocation)

    aprxMap = loadMap(project)

    wms_draft = aprxMap.getWebLayerSharingDraft("FEDERATED_SERVER", "MAP_IMAGE", serviceName)

    wms_draft.federatedServerUrl = arcgisServerUrl

    wms_draft.serviceName = serviceName

    wms_draft.summary = "BGT"

    wms_draft.tags = "BGT,WMS"

    wms_draft.description = "BGT als mapservice en WMS"

    wmsSDDraft = stagingFolder + "\\" + serviceName + "_wms.sddraft"

    try:

        wms_draft.exportToSDDraft(wmsSDDraft)

    except:

        print(arcpy.GetMessages())

else:

    logInformation("aanmaken sd-draft file voor mapservice/WMS wordt overgeslagen", True,False,False)

 

wmsSD = stagingFolder + "\\" + serviceName + "_wms.sd"

if createFilesWMS:

    arcpy.env.overwriteOutput = True

    logInformation("mapservice/WMS sd file maken", True,False,False)

    try:

        arcpy.StageService_server(wmsSDDraft, wmsSD)

 

I am curious what I do wrong here to make my map a hosted map service layer and how can I publish my map with wms-capabilities?

CEO the Right Direction BV/Portal Genius
0 Kudos
1 Reply
DamasoAvalos_Ruiz1
New Contributor III

Hello

Did you find any solution?

Thanks

0 Kudos