Working with the ArcGIS for Server SOAP API
The ESRI.ArcGIS.ADF.ArcGISServer namespace contains a number of Value objects and a proxy for each service type (for example, map, geocode, geoprocessing). The following are the types of proxies:
- Web service proxy
- Distributed Component Object Model (DCOM) proxy
Web service proxies work with ArcGIS for Server services via Web service endpoints. DCOM proxies work with ArcGIS for Server services via a SOM (server object manager) endpoint over DCOM.
Web service proxies and Value objects are often generated by Web service toolkits (for example, the Microsoft .NET software development kit [SDK] tool, wsdl.exe) by consuming a Web Service Description Language (WSDL). The WSDL indicates to a consumer how they can interact with the service. The consumer is responsible for generating native client classes to support working with the service. A standard protocol for working with the service, especially Web services, is the SOAP.
The Value objects store values and the proxy serializes the values into the SOAP to be sent to the remote service. When the SOAP response is returned, the proxy deserializes it and creates the appropriate Value objects for use on the client.
The Web service proxy generated for an ArcGIS for Server Web service can be extended to support SOAP over DCOM via a DCOM proxy. The Web ADF includes a DCOM proxy to use the ArcGIS for Server SOAP API to interact with an ArcGIS for Server service over a Local connection. The ArcGIS for Server implementation of the Web ADF Common Data Source API (in the ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer) exposes access to a Web service or DCOM proxy via a resource base class.
For map resources, it is the MapResourceBase class. MapResourceBase is shared by ArcGIS for Server Internet and Local connections. For Internet connections, MapServerProxy is used to communicate with an ArcGIS for Server service. For Local connections, MapServerDcomProxy extends MapServerProxy and is used instead. Both proxies work with the same Value objects, although the immediate endpoints are different. In the end, both situations eventually work with the IRequestHandler interface on a server object to interact with a service via ArcGIS for Server SOAP.
See the following code example:
[C#]
foreach (ESRI.ArcGIS.ADF.Web.DataSources.IGISFunctionality gisFunctionality in
Map1.GetFunctionalities())
{
if (gisFunctionality is
ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapFunctionality)
{
ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapFunctionality
agsMapFunctionality =
(ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapFunctionality)
gisFunctionality;
ESRI.ArcGIS.ADF.ArcGISServer.MapDescription agsSoapMapDescription =
agsMapFunctionality.MapDescription;
ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapResourceBase
agsMapResourceBase = agsMapFunctionality.MapResource;
// Working with the same type of map server proxy and Value objects generated from ArcGIS for Server
// map service, WSDL.
ESRI.ArcGIS.ADF.ArcGISServer.MapServerProxy agsSoapMapServerProxy =
agsMapResourceBase.MapServerProxy;
ESRI.ArcGIS.ADF.ArcGISServer.MapServerInfo agsSoapMapServerInfo =
agsSoapMapServerProxy.GetServerInfo
(agsSoapMapServerProxy.GetDefaultMapName());
ESRI.ArcGIS.ADF.ArcGISServer.MapLayerInfo[] agsSoapMapLayerInfoArray =
agsMapResourceBase.MapServerInfo.MapLayerInfos;
ESRI.ArcGIS.ADF.ArcGISServer.LayerDescription[] agsSoapLayerDescriptionArray
= agsSoapMapDescription.LayerDescriptions;
for (int i = 0; i < agsSoapMapLayerInfoArray.Length; i++)
{
ESRI.ArcGIS.ADF.ArcGISServer.MapLayerInfo agsSoapMapLayerInfo =
agsSoapMapLayerInfoArray[i];
ESRI.ArcGIS.ADF.ArcGISServer.LayerDescription agsSoapLayerDescription =
agsSoapLayerDescriptionArray[i];
}
}
}
[VB.NET]
For Each gisFunctionality As ESRI.ArcGIS.ADF.Web.DataSources.IGISFunctionality In Map1.GetFunctionalities()
If TypeOf gisFunctionality Is ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapFunctionality Then
Dim agsMapFunctionality As ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapFunctionality = CType(gisFunctionality, ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapFunctionality)
Dim agsSoapMapDescription As ESRI.ArcGIS.ADF.ArcGISServer.MapDescription = agsMapFunctionality.MapDescription
Dim agsMapResourceBase As ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapResourceBase = agsMapFunctionality.MapResource
' Working with the same type of map server proxy and Value objects generated from ArcGIS for Server
' map service, WSDL.
Dim agsSoapMapServerProxy As ESRI.ArcGIS.ADF.ArcGISServer.MapServerProxy = agsMapResourceBase.MapServerProxy
Dim agsSoapMapServerInfo As ESRI.ArcGIS.ADF.ArcGISServer.MapServerInfo = agsSoapMapServerProxy.GetServerInfo(agsSoapMapServerProxy.GetDefaultMapName())
Dim agsSoapMapLayerInfoArray As ESRI.ArcGIS.ADF.ArcGISServer.MapLayerInfo() = agsMapResourceBase.MapServerInfo.MapLayerInfos
Dim agsSoapLayerDescriptionArray As ESRI.ArcGIS.ADF.ArcGISServer.LayerDescription() = agsSoapMapDescription.LayerDescriptions
Dim i As Integer = 0
Do While i < agsSoapMapLayerInfoArray.Length
Dim agsSoapMapLayerInfo As ESRI.ArcGIS.ADF.ArcGISServer.MapLayerInfo = agsSoapMapLayerInfoArray(i)
Dim agsSoapLayerDescription As ESRI.ArcGIS.ADF.ArcGISServer.LayerDescription = agsSoapLayerDescriptionArray(i)
i + = 1
Loop
End If
Next gisFunctionality
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):