Select to view content in your preferred language

Overwrite a Service with registered data using a Service Defintion File

1886
6
Jump to solution
12-07-2021 02:56 AM
TWickiSLU
Occasional Contributor

We would like to manage/publish our services on different environments with service definition files (SD files). However, I realised that it is not possible to overwrite an existing service with registered data by using an SD file (screenshot 1). 

It is of course possible to delete the service and republish it. However, republishing the service like this changes the itemID of the corresponding portal-item. An existing web map which consumes this service will still work (probably because the rest-url of the service is still the same), but the newly published item can no longer be called in the overview page of the web map item, because the link still contains the old itemID (screenshot 2). This can be fixed by changing the ItemID of the service in the JSON configuration file of the web map item on the portal server. However, this workaround cannot be the proper solution.

Is there really no way to overwrite a service with registered data using an SD file without changing the ID of the corresponding portal item?

product-version: ArcGIS Enterprise 10.8.1

 

Screenshot 1:

Fig_1.jpg

Screenshot 2:

Fig_2.jpg

1 Solution

Accepted Solutions
ChrisPy
Regular Contributor

Yup your right, that version is for standalone servers, here is for the federated one,

https://pro.arcgis.com/en/pro-app/latest/arcpy/sharing/mapimagesharingdraft-class.htm#GUID-51F10F68-...

I tested it on a map service i published on our 10.8.1 enterprise setup, it works as expected and portal ids are retained after publishing the sd file.

This is for FS, https://pro.arcgis.com/en/pro-app/latest/arcpy/sharing/featuresharingdraft-class.htm

 

View solution in original post

0 Kudos
6 Replies
ABishop
MVP Regular Contributor

Hello,

First of all... are you using a referenced feature service in Enterprise Portal or is this a hosted feature service?

Amanda Bishop, GISP
0 Kudos
TWickiSLU
Occasional Contributor

Hi, I’m using a referenced feature service in Enterprise Portal. The feature service is based on a database which is registered on the ArcGIS Portal Server.

0 Kudos
ChrisPy
Regular Contributor

You probably are missing a step before uploading the service definition,

Check this article, https://pro.arcgis.com/en/pro-app/latest/help/sharing/overview/publish-services.htm

And you can also check this script in this arcticle for overwriting services, https://pro.arcgis.com/en/pro-app/latest/arcpy/sharing/mapservicedraft-class.htm#GUID-F39810A0-180C-...

They talk about capability to overwrite so you dont have to lose your portal item ID.

0 Kudos
TWickiSLU
Occasional Contributor

Thanks a lot for the response. Yes, I directly created the service definition file (.sd) and missed the step of creating a map service definition draft (.sddraft). The workflow works fine for a Standalone ArcGIS Server but when I use the script to create the draft for a Portal ArcGIS Server the function «arcpy.sharing.CreateSharingDraft» returns an error indicating that the target server is not a standalone server.

In the script in this articel, https://enterprise.arcgis.com/en/server/latest/develop/windows/example-publish-service-definitions-l..., they delete and republish the service..  but then the ItemID of the Portal Item will probably change.

0 Kudos
ChrisPy
Regular Contributor

Yup your right, that version is for standalone servers, here is for the federated one,

https://pro.arcgis.com/en/pro-app/latest/arcpy/sharing/mapimagesharingdraft-class.htm#GUID-51F10F68-...

I tested it on a map service i published on our 10.8.1 enterprise setup, it works as expected and portal ids are retained after publishing the sd file.

This is for FS, https://pro.arcgis.com/en/pro-app/latest/arcpy/sharing/featuresharingdraft-class.htm

 

0 Kudos
TWickiSLU
Occasional Contributor

Thanks a lot! It works

 

0 Kudos