This topic assumes that a MapResourceManager and Map (named Map1) are available in the current scope (for example, in the Page). The sample code references the default dataframe in the server object. Note that a MapLayerInfo and LayerDescription can be retrieved for each layer.
The ESRI.ArcGIS.ADF.ArcGISServer namespace contains a number of Value objects and a proxy for each service type (e.g. map, geocode, geoprocessing). There are two types of proxies, a Web service proxy and a DCOM proxy. Web service proxies work with ArcGIS Server services via Web service endpoints. DCOM proxies work with ArcGIS Server services via a SOM (Server Object Manager) endpoint over DCOM. Web service proxies and Value objects are often generated by Web service toolkits (e.g. Microsoft .NET SDK tool - wsdl.exe) by consuming a WSDL (Web Service Description Language). The WSDL tells a consumer how they can interact with the service. The consumer is responsible for generating the native client classes to support working with the service. A standard protocol for working with service, especially Web services, is SOAP (Simple Object Access Protocol). The Value objects store values and the proxy serializes the values into 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 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 Server SOAP API to interact with an ArcGIS Server service over a Local connection. The ArcGIS Server implementation of the Web ADF Common Data Source API (in the ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer) exposes access to either a Web service or DCOM proxy via a resource base class. For map resources it is the MapResourceBase class. MapResourceBase is shared by both ArcGIS Server Internet and Local connections. For Internet connections, MapServerProxy is used to communicate with an ArcGIS 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 Server SOAP.
[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 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 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):