1

I have read documentation on overwriting ArcGIS service via python. The overall process to programmatically overwrite service is to save a service definition draft, in the .sddraft file the set service type to from esriServiceDefinitionType_New to esriServiceDefinitionType_Replacement, then stage the .sddraft to a .sd file, and upload the .sd file.

What is the difference between setting the service type to from esriServiceDefinitionType_New to esriServiceDefinitionType_Replacement in the .sddraft file and setting it in the .sd file?

I ask this because I have several .sd files already created, and with a simple 7zip extraction I can open the .sd file and see the service type setting in the manifest.xml.

In theory I would like to make the service type change here in the .sd file, then upload and overwrite my existing service.

My current plan is to continue testing, and if all seems well, stick to this approach.

My environments: ArcGIS Server 10.3.1 & ArcMap 10.3.1

6

There should be no difference, except that editing the *.sd file directly is not officially supported by ESRI.

I have begun testing scripted modifications to SDs myself with favorable results, although the 7zip format is a bit harder to work with in Python than normal ZIP files (you need to use the nonstandard pylzma.py7zlib library if using Python 2.7, or call the 7zip executable via a subprocess). I used the compression settings suggested in this question and everything has been working fine so far.

Even without setting the "esriServiceDefinitionType_Replacement" value in the SD Draft XML, my publishing scripts are able to overwrite existing services when following the full CreateMapSDDraft(), AnalyzeForSD(), StageService_server(), UploadServiceDefinition_server() approach, but I seem to run into problems periodically when simply performing the Upload step with existing SD files. Sometimes the job succeeds, sometimes it fails, and sometimes I wind up with duplicate services with a timestamp appended to the service name.

For that reason, I have found it more reliable to simply delete a service before publishing a replacement service, rather than overwriting. The delete operation can be scripted easily using the ArcGIS Admin REST API. I would highly recommend this approach rather than attempting to overwrite each time.

  • You are describing my exact scenario that I have been going through. After more testing, I also choose to go the delete service method as well, I have been able to script this successfully. – a1234 Jun 1 '15 at 15:18

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.