Sharing WMS/WFS with Python

1849
4
09-04-2020 08:06 AM
CecíliaSouza
New Contributor

Hello everyone!

I've been trying to publish WMS/WFS services with arcpy in ArcGIS Pro 2.6, but it always ends up with this same error: "code":"00297","message":"WFS layers must be shared with everyone".

I came across that it is originated from this bug: BUG-000095939: Secured Open Geospatial Consortium (OGC) services fr.. 

My questions are: How can I "share to everyone" with arcpy/python? There is a function or parameter that I've missed?

This is solvable only by changing the sddraft xml?

Below is the main part of the script (thanks to Shilpi Jain from Esri).

arcpy.SignInToPortal(portalURL, username, password)
aprx = arcpy.mp.ArcGISProject(aprxPath)
m = aprx.listMaps("Map")[0]

sharing_draft = m.getWebLayerSharingDraft("FEDERATED_SERVER", "MAP_IMAGE", serviceName) 
sharing_draft.federatedServerUrl = fed_server
sharing_draft.portalFolder = "SD"
sharing_draft.serverFolder = "SD"
sharing_draft.exportToSDDraft(sddraftPath)

enable_extensions(sddraftPath, "FeatureServer")
enable_extensions(sddraftPath, "WMSServer")
enable_extensions(sddraftPath, "WFSServer")

arcpy.StageService_server(sddraftPath, sdPath)
arcpy.UploadServiceDefinition_server(sdPath, fed_server)‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Thank you for your time,

Cecília

Tags (2)
4 Replies
JonahLay
Esri Contributor

Hi Ceclia,

Can you try adding the following to your Python script?

shrOrg = False
shrEveryone = True 
shrGroups = ""

See the following article for more information: How To: Overwrite hosted feature services from ArcGIS Pro to ArcGIS Online using Python 

Best,

Jonah

inolaroch
New Contributor III

Hi @CecíliaSouza ,

Can u post the full script please ?

Thank you.

 

0 Kudos
CecíliaSouza
New Contributor

Hi @inolaroch,

You can find the full script here:

https://github.com/jnshill/ArcPyPublishing

Best,

Cecilia

inolaroch
New Contributor III

Thank you so much 🙂

 

0 Kudos