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") 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,
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