ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • Aide
  • Sign Out
ArcGIS Desktop

ArcGIS Online

La plateforme cartographique de votre organisation

ArcGIS Desktop

Un SIG professionnel complet

ArcGIS Enterprise

SIG dans votre entreprise

ArcGIS for Developers

Outils de création d'applications de localisation

ArcGIS Solutions

Modèles d'applications et de cartes gratuits pour votre secteur d'activité

ArcGIS Marketplace

Téléchargez des applications et des données pour votre organisation.

  • Documentation
  • Support
Esri
  • Se connecter
user
  • Mon profil
  • Déconnexion

ArcMap

  • Accueil
  • Commencer
  • Carte
  • Analyser
  • Gérer les données
  • Outils
  • Extensions

ListMapServices

  • Résumé
  • Discussion
  • Syntaxe

Résumé

Héritage :

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 Server Administrator API.

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

Discussion

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 Server.

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

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

Remarque :

The URL of the Site Directory may vary if you have configured ArcGIS 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 Server Administrator API to list Map Services is below:

Remarque :

A code sample to generate an ArcGIS 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 Server REST API which is available through the ArcGIS Services Directory. The default URL of the ArcGIS Server Services Directory is as follows:

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

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

An example of using Python and the ArcGIS 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()

Syntaxe

ListMapServices (connection_url_or_name, server, {connection_username}, {connection_password}, {connection_domain})
ParamètreExplicationType de données
connection_url_or_name

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

String
server

A string that represents the ArcGIS Server host name.

String
connection_username

A string that represents a user name used to connect to the ArcGIS Server. In order to get a list of map services 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.

(La valeur par défaut est 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.

(La valeur par défaut est 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.

(La valeur par défaut est None)

String

Valeur renvoyée

Type de donnéesExplication
List

A Python list of map services.

ArcGIS Desktop

  • Accueil
  • Documentation
  • Support

ArcGIS Platform

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

A propos d'Esri

  • A propos de la société
  • Carrières
  • Blog d’Esri
  • Conférence des utilisateurs
  • Sommet des développeurs
Esri
Donnez-nous votre avis.
Copyright © 2019 Esri. | Confidentialité | Légal