Connecting to an ArcGIS for Server Web service
This topic shows how to connect to an ArcGIS for Server Web Service endpoint using pre-created Value objects and a proxy class included with the Web Application Developer Framework (ADF). Since the Web Service Description Language (WSDL) for an ArcGIS for 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 for Server Web Service endpoint of the same type (for example, MapServer). You can also generate your client-side Value objects and proxy classes by using a SOAP toolkit.
The endpoint for an ArcGIS for Server Web service takes the form of service_name/service_type. In the following code example, "MapServer" is the service_type. There might 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.
Do the following steps:
- Set up a Web application with the Web ADF assembly.
- Edit the endpoint variable and change the "servicename" to a valid service name.
- Edit the value for the MapServerProxy constructor to include a valid Web server name and path to ArcGIS for Server Web service endpoints.
string serverName = "localhost";
string instance = "arcgis/services";
// Using the ADF Common API data source implementation of the ArcGIS for 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 for 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