How to connect to an ArcGIS Server web service


Summary This topic demonstrates how to connect to an ArcGIS Server Web service. The ArcGIS Server SOAP API can be used to interact with a Web service directly via it's MapDescription and LayerDescription. Each service type (e.g. map service) maintains its own proxy class which serializes SOAP requests to and deserializes SOAP responses from an ArcGIS Server Web service. Client-side Value objects, such as MapDescription and LayerDescription, store values which are used by the proxy during the serialization process. Developers will often interact with the Value objects to construct a SOAP request and call methods on the proxy to send the request. Value objects offer the benefit of working with classes in a native client-side development environment which manage interaction with SOAP strings. Otherwise, a developer would be required to manage (create, append, parse) SOAP, which can be a labor intensive task.

This topic shows how to connect to an ArcGIS Server Web Service endpoint using pre-created Value objects and a proxy class included with the Web ADF. Since the Web Service Description Language (WSDL) for an ArcGIS Server service type is always the same, the Value objects and proxy class in the Web ADF can be used to connect to any ArcGIS Server Web Service endpoint of the same type (e.g. MapServer). You can also generate your own client-side Value objects and proxy classes by using a SOAP toolkit.

The endpoint for an ArcGIS Server Web service takes the form of service_name/service_type. In the example below, the service_type is "MapServer". There may also be a folder containing one or more services under service_type. In that situation the endpoint takes the form folder_name/service_name/service_type. Folders can be created in ArcCatalog and Manager.
  1. Setup a web application with the Web ADF assembly, as listed in the assemblies section above.
  2. Edit the endpoint variable and change the "servicename" to a valid service name.
  3. Edit the value for the MapServerProxy constructor to include a valid web server name and path to ArcGIS Server Web service endpoints.
[C#]
string serverName = "localhost";
string instance = "arcgis/services";

// Using the ADF Common API data source implementation of the ArcGIS Server Web Service API
string serviceNameAndType = "MapFusedCache/MapServer";

ESRI.ArcGIS.ADF.ArcGISServer.MapServerProxy agsSoapMapServerProxy = new
    ESRI.ArcGIS.ADF.ArcGISServer.MapServerProxy("http://" + serverName + "/" +
    instance + "/" + serviceNameAndType);

ESRI.ArcGIS.ADF.ArcGISServer.MapServerInfo agsSoapMapServerInfo =
    agsSoapMapServerProxy.GetServerInfo(agsSoapMapServerProxy.GetDefaultMapName());

ESRI.ArcGIS.ADF.ArcGISServer.MapDescription agsSoapMapDescription =
    agsSoapMapServerInfo.DefaultMapDescription;
[VB.NET]
Dim serverName As String = "localhost"
Dim instance As String = "arcgis/services"

' Using the ADF Common API data source implementation of the ArcGIS Server Web Service API
Dim serviceNameAndType As String = "MapFusedCache/MapServer"

Dim agsSoapMapServerProxy As ESRI.ArcGIS.ADF.ArcGISServer.MapServerProxy = New ESRI.ArcGIS.ADF.ArcGISServer.MapServerProxy("http://" & serverName & "/" & instance & "/" & serviceNameAndType)

Dim agsSoapMapServerInfo As ESRI.ArcGIS.ADF.ArcGISServer.MapServerInfo = agsSoapMapServerProxy.GetServerInfo(agsSoapMapServerProxy.GetDefaultMapName())

Dim agsSoapMapDescription As ESRI.ArcGIS.ADF.ArcGISServer.MapDescription = agsSoapMapServerInfo.DefaultMapDescription






To use the code in this topic, reference the following assemblies in your Visual Studio project. In the code files, you will need using (C#) or Imports (VB .NET) directives for the corresponding namespaces (given in parenthesis below if different from the assembly name):
  • ESRI.ArcGIS.ADF.ArcGISServer