0

I wrote a python script to create an MXD from template and auto publish it.

The following is the excerpt of my code:

#publish MXD method
def PublishMXDToArcGISServer(id, in_arcgisAgs, in_publishWS):
  sddraft = "{}\\SDDRAFT\\{}.sddraft".format(in_publishWS, id);
  service_name = id.replace('-', '_').replace('.','')

  # add the layer file to your map
  mxd_location = "{}\\MXD\\{}.mxd".format(in_publishWS, id)
  mxd = arcpy.mapping.MapDocument(mxd_location)

  #Create SDDRAFT file
  analysis = arcpy.mapping.CreateMapSDDraft(mxd, sddraft, service_name, 'ARCGIS_SERVER', in_arcgisAgs, False, "Folder");

  sd = "{}\\SDDRAFT\\{}.sd".format(in_publishWS, id);

  arcpy.StageService_server(sddraft, sd)

  arcpy.UploadServiceDefinition_server(sd, in_arcgisAgs)

Above code can successfully published the map service, but when I added a new field or alter a field in the feature class, the updated field is not reflected on the Map Service.

But when I used an ArcGIS Desktop to publish a map service, any new field or altered field in the under lying feature class, is reflected on the map service.

Is there any thing i need to specify when publishing using ArcPy in order for the updated field to be reflected on the Map Service?

Updating Web Map Service (WMS) by default when data amended in Oracle source tables? mentioned a similar issue but I do not understand the answer given.

  • 1
    Making structural changes to a table isn't the sort of change that will automatically be recognized. INSERT, UPDSTE, and DELETE operations would be, but anything that alters the schema needs to be republished. – Vince Jul 26 '16 at 12:04
0

As mentioned by Vince in the comment: Making structural changes to a table isn't the sort of change that will automatically be recognized. INSERT, UPDSTE, and DELETE operations would be, but anything that alters the schema needs to be republished.

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.