PublishMSDToServer

Zusammenfassung

Publishes an existing map service definition (MSD) file to a designated ArcGIS Server.

Beschreibung

Once you have saved your MSD, the next step is to create a map service for deployment using ArcGIS Server. Using PublishMSDToServer is one way to do this.

You must be a member of the server's ArcGIS Server admin group to publish the service.

This function can only be used with ArcGIS Server 10. You cannot publish to servers previous to ArcGIS 10.

There are two parts to this function—one part is information needed to connect to the ArcGIS Server, while the other includes information on the service itself.

First, to connect to the ArcGIS server, you need to supply both the server host name (server) and the server URL (connection_url_or_name). If you are connecting to a UNIX/Linux server, you will also need to supply authentication information. This includes the user name (connection_username), password (connection_password), and domain (connection_domain). If you are not publishing to a UNIX/Linux server, you do not need to supply this information, since authentication information is provided by the OS.

There are two important considerations when publishing a map service. First, the map's data needs to be accessible to the ArcGIS server. For more information, see Preparing resources for publishing as services. Second, to create a map service, the user running this script must be a member of the ArcGIS Server admin group on the server. For more information, see Adding users to the agsusers group.

Lastly, you need to supply information concerning the service you are publishing. This includes the MSD (.msd) you want to publish, the name of the service you are publishing (service_name), a folder you might want to publish to (folder_name), and a list of capabilities that you want the service to have.

For more information on map service capabilities, see Map service capabilities.

For more information on analyzing map documents for conversion to .msd files for optimized map publishing, see Publishing optimized map services.

See also: AnalyzeForMSD and ConvertToMSD.

Syntax

PublishMSDToServer (msd_path, connection_url_or_name, server, service_name, {folder_name}, {service_capabilities}, {connection_username}, {connection_password}, {connection_domain})
ParameterErläuterungDatentyp
msd_path

A string that represents the path and name of an existing MXD document you want to serve.

String
connection_url_or_name

A string that represents the URL of the ArcGIS server to which you want to publish the MSD.

String
server

A string that represents the ArcGIS server host name to which you want to publish the MSD.

String
service_name

A string that represents the name of the service. This is the name people will see and use to identify the service. The name can only contain alphanumeric characters and underscores. No spaces or special characters are allowed. The name cannot be more than 120 characters in length.

String
folder_name

A string that represents a folder name to which you want to publish the MSD. If the folder does not currently exist, it will be created. The default folder is the server root level.

String
service_capabilities
[service_capabilities,...]

A list of strings that represents additional capabilities in addition to the map service capability.

  • MAPPINGThe default ArcGIS Server capability
  • KMLKeyhole Markup Language
  • WCSWeb Coverage Service
  • WFSWeb Feature Service
  • WMSWeb Map Service

(Der Standardwert ist MAPPING)

String
connection_username

A string that represents a user name used to connect to the ArcGIS server. To publish a map service, this user name should be a member of the ArcGIS Server admin group. This variable is only necessary when connecting to a UNIX/Linux ArcGIS server.

(Der Standardwert ist None)

String
connection_password

A string that represents a password used to connect to the ArcGIS server. This variable is only necessary when connecting to a UNIX/Linux ArcGIS server.

(Der Standardwert ist None)

String
connection_domain

A string that represents a domain name used to connect to the ArcGIS server. This variable is only necessary when connecting to a UNIX/Linux ArcGIS server.

(Der Standardwert ist None)

String

Codebeispiel

PublishMSDToServer example

Publish MSD to an ArcGIS Server

This script publishes a map service definition (MSD) file to an ArcGIS Server named MyServer. The map service, named MyMapService, is being published to a folder named MyMapServiceFolder. The service includes WMS and KML capabilities.

import arcpy
msd = r"C:\Project\Project.msd"
arcpy.mapping.PublishMSDToServer (msd, "http://<MyServer>/arcgis/services", "<MyServer>", "MyMapService", "MyMapServiceFolder", ["WMS", "KML"])


7/10/2012