ArcGIS for Desktop

  • Documentación
  • Precios
  • Soporte

  • My Profile
  • Ayuda
  • Sign Out
ArcGIS for Desktop

ArcGIS Online

La plataforma de representación cartográfica para tu organización

ArcGIS for Desktop

Un completo SIG profesional

ArcGIS for Server

SIG en tu empresa

ArcGIS for Developers

Herramientas para crear aplicaciones basadas en la ubicación

ArcGIS Solutions

Plantillas de aplicaciones y mapas gratuitas para tu sector

ArcGIS Marketplace

Obtén aplicaciones y datos para tu organización.

  • Documentación
  • Precios
  • Soporte
Esri
  • Iniciar sesión
user
  • Mi perfil
  • Cerrar sesión

Help

  • Inicio
  • Introducción
  • Mapa
  • Analizar
  • Administrar datos
  • Herramientas
  • Más...

ListMapServices

  • Resumen
  • Debate
  • Sintaxis

Resumen

Herencia:

This method has been deprecated starting at ArcGIS 10.1 for Server and ArcGIS 10.1 for Desktop and will return a runtime error. Please consult the ArcGIS documentation for the usage of the new ArcGIS for Server Administrator API.

Lists the names of map services for a designated ArcGIS for Server.

Debate

This method has been deprecated starting at ArcGIS 10.1 for Server and ArcGIS 10.1 for Desktop and will return a runtime error.

ArcGIS 10.1 for Server has a new architecture which may require you to adjust how you work with the server. See the following help topic for more information: What to expect when migrating to ArcGIS for Server.

You can list Map Services using the ArcGIS for Server Administrator API which is available through the ArcGIS Site Directory. The default URL of the ArcGIS for Server Site Directory is as follows:

http://<server name>:6080/arcgis/admin

Nota:

The URL of the Site Directory may vary if you have configured ArcGIS for Server Web Adaptor to work with your site. For example, the inclusion of the port number, 6080, may not be required. Check your web adaptor configuration to obtain the correct URL.

An example of using Python and the ArcGIS for Server Administrator API to list Map Services is below:

Nota:

A code sample to generate an ArcGIS for Server token can be found here: DeleteMapService.

import json, urllib2

server = "<server>"
port = "6080"
token = '<token string>'
baseUrl = "http://{}:{}/arcgis/admin/services".format(server, port)

def getCatalog(token):
  catalog = json.load(urllib2.urlopen(baseUrl + "/" + "?f=json&token=" + token))
  print 'Root' 
  if "error" in catalog: return
  services = catalog['services']
  for service in services:
    response = json.load(urllib2.urlopen(baseUrl + '/' + service['serviceName'] + '/' + service['type'] + "?f=json&token=" + token))
    print '  %s %s (%s)' % (service['serviceName'], service['type'], 'ERROR' if "error" in response else 'SUCCESS')
  folders = catalog['folders']
  for folderName in folders:
    catalog = json.load(urllib2.urlopen(baseUrl + "/" + folderName + "?f=json&token=" + token))
    print folderName
    if "error" in catalog: return
    services = catalog['services']
    for service in services:
      response = json.load(urllib2.urlopen(baseUrl + '/' + service['serviceName'] + '/' + service['type'] + "?f=json&token=" + token))
      print '  %s %s (%s)' % (service['serviceName'], service['type'], 'ERROR' if "error" in response else 'SUCCESS')

getCatalog(token)

You can also list Map Services using the ArcGIS for Server REST API which is available through the ArcGIS Services Directory. The default URL of the ArcGIS for Server Services Directory is as follows:

http://<server name>:6080/arcgis/rest/services

To get started using the ArcGIS for Server Services Directory and REST API, see the help within the Services Directory.

An example of using Python and the ArcGIS for Server REST API to list Map Services is below:

import json, urllib2

server = "<server>"
port = "6080"
baseUrl = "http://{}:{}/arcgis/rest/services".format(server, port)

def getCatalog():
  catalog = json.load(urllib2.urlopen(baseUrl + "/" + "?f=json"))
  print 'ROOT' 
  if "error" in catalog: return
  services = catalog['services']
  for service in services:
    response = json.load(urllib2.urlopen(baseUrl + '/' + service['name'] + '/' + service['type'] + "?f=json"))
    print '  %s %s (%s)' % (service['name'], service['type'], 'ERROR' if "error" in response else 'SUCCESS')
  folders = catalog['folders']
  for folderName in folders:
    catalog = json.load(urllib2.urlopen(baseUrl + "/" + folderName + "?f=json"))
    print folderName
    if "error" in catalog: return
    services = catalog['services']
    for service in services:
      response = json.load(urllib2.urlopen(baseUrl + '/' + service['name'] + '/' + service['type'] + "?f=json"))
      print '  %s %s (%s)' % (service['name'], service['type'], 'ERROR' if "error" in response else 'SUCCESS')

getCatalog()

Sintaxis

ListMapServices (connection_url_or_name, server, {connection_username}, {connection_password}, {connection_domain})
ParámetroExplicaciónTipo de datos
connection_url_or_name

A string that represents the URL of the ArcGIS for Server to which you want to get a list of services.

String
server

A string that represents the ArcGIS for Server host name.

String
connection_username

A string that represents a user name used to connect to the ArcGIS for Server. In order to get a list of map services this user name should be a member of the ArcGIS for Server admin group. This variable is only necessary when connecting to a UNIX/Linux ArcGIS for Server.

(El valor predeterminado es None)

String
connection_password

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

(El valor predeterminado es None)

String
connection_domain

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

(El valor predeterminado es None)

String

Valor de retorno

Tipo de datosExplicación
List

A Python list of map services.

¿Algún comentario sobre este tema?

ArcGIS for Desktop

  • Inicio
  • Documentación
  • Precios
  • Soporte

Plataforma ArcGIS

  • ArcGIS Online
  • ArcGIS for Desktop
  • ArcGIS for Server
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

Acerca de Esri

  • Quiénes somos
  • Empleo
  • Blog interno
  • Conferencia de usuarios
  • Cumbre de desarrolladores
Esri
© Copyright 2016 Environmental Systems Research Institute, Inc. | Privacidad | Legal