I have to create web services on ArcGIS Enterprise (via ArcGIS Pro) that offer WMS/WFS capabilities from several hundred datasets coming from Enterprise geodatabases. While this is not a problem when being done manually (I simply check the respective check boxes when using "Share as a Web Layer" - see image below), I am not able to find a way how to do that with Python.

enter image description here

In Python I have been using getWebLayerSharingDraft, exportToSDDraft, arcpy.StageService_server and arcpy.UploadServiceDefinition_server. This works pretty well, however, I only end up with a Map Image Service and Feature Service and have no idea how to get WMS and WFS. There seems to be no option to also create those services.

1 Answer 1


I found a solution for my problem:

In fact, the ArcGIS API for Python and arcpy to not offer possibilities to adapt the WMS/WFS settings directly while publishing. However, there is a workaround:

The base for every service that is being published is a .sddraft-file (getWebLayerSharingDraft), which then gets then gets transferred in to a .sd file (arcpy.StageService_server) and finally uploaded to the server/portal (arcpy.UploadServiceDefinition_server).

The .sddraft-file in fact is an XML-file that contains all information about the service (including WMS/WFS/FeatureAccess settings, and much more). If you edit the .sddraft file before you start the the Staging/Uploading you can adjust settings that are not available via the ArcGIS Python API or arcpy.

Please find some more information here: The "Modify SDDraft example 3" deals with activating WMS. This works the same way for WFS, but there are much more settings that can be changed,

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.