The algorithm I have so far is basically this:
- Create a
sddraft from a mxd file (using arcpy.CreateMapSDDraft(). - Stage
sddraft into a sd file (using arcpy.StageService_server(). - Upload
sd file to ArcGIS server over REST.- There's a little dance that has to happen due to the fact that we use
web-adaptor and have to redirect all requests to a single-sign-on server first for authentication, before forwarding the intended request to the intended destination.
- Call
createService on ArcGIS server's REST API, pointing to the uploaded sd file.- This happens in the same http session, so no need to go through the authentication dance again.
The fourth step manages to create the service, but startup fails due to Invalid file. The only documentation for the createService endpoint that I could find is this, and I can only surmise that the endpoint only accepts the old and deprecated msd file, but not the newer sd file. If that's the case, what endpoint am I supposed to hit for creating a service from a sd file? Note that arcpy.UploadServiceDefinition() isn't an option for us due to the fact that authentication is handled elsewhere from the ArcGIS server.