Automating Publishing to a Federated Server

1027
6
05-22-2020 09:47 AM
MichaelLayne1
Occasional Contributor

We're trying to script publishing feature services that reference our sde data to a server federated to Portal.

I've had success using getWebLayerSharingDraft to publish a MapImage service to the federated server which seems to reference our sde data, and I've had success publishing a Feature Service but it only seems to publish to the HOSTING_SERVER which makes me think it is being stored in the Data Store associated with the Federated Server and thus is only a copy of our sde data.

If you look at the guts of  _mp.py for getWebLayerSharingDraft you'll see that FEDERATED_SERVER is only compatible with MAP_IMAGE and that FEATURE is only compatible with MY_HOSTED_SERVICES or HOSTING_SERVER.

I've tried to go the route of using CreateSharingDraft but that only seems to be able to access a standalone_server and not a federated server.

Has anyone had any luck?

0 Kudos
6 Replies
MarthaBarboza
New Contributor

I am having the same problem.  Have you found a solution yet? 

0 Kudos
MichaelLayne1
Occasional Contributor

Unfortunately, I have not.

0 Kudos
GisAdminCOG
New Contributor II

I seem to be having the same problem.  Are you getting and error?

Here is what I see..


File "C:/batch/Publish_Service.py", line 359, in <module>
sharing_draft.exportToSDDraft(sddraft_output_filename)
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\sharing.py", line 66, in exportToSDDraft
return _convertArcObjectToPythonObject(self._arc_object.exportToSDDraft(out_sddraft,self))
ValueError: Unable to create the manifest (sddraft file). An unspecified error occurred.

0 Kudos
kamil_szyc
New Contributor II

Have you found a solution to this problem and remember it?

I am getting the same output

0 Kudos
hashimotoy2
New Contributor III

I am having the same issue when trying to overwrite a hosted Map Image Service; it is tripping up on the function to export the draft Service Definition (see error output below). I've confirmed the server is of type 'FEDERATED_SERVER'.

Has anyone else found a solution or workaround? 

File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\sharing.py", line 66, in exportToSDDraft
return _convertArcObjectToPythonObject(self._arc_object.exportToSDDraft(out_sddraft,self))
ValueError: Target server is not a federated server or is inaccessible.

hashimotoy2
New Contributor III

I resolved my problem which was due to my using the server URL reported by listing the servers after connecting to the portal: 

print("Connecting to {}".format(portal))
gis = GIS(portal, user, password)
server = gis.admin.servers.list()[0]

The URL reported in the 'server' variable had appended the server manager designation to the URL - once this was removed it was fine. 

Near always it is the simplest things over which we trip...*sigh*

0 Kudos