Common Access the ArcGIS Server SOAP API

This sample demonstrates how to work with an ArcGIS Server service using the SOAP API implementation that is part of the Web ADF. 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 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 its 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.

This sample assumes that a MapResourceManager and Map (named Map1) is 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. In general, MapLayerInfo is used to get properties of a layer while LayerDescription can be used to get and set layer properties. LayerDescription provides a means for maintaining changes to layers in session, without changing the underlying fine-grained ArcObjects of the server object.
 1
 2IEnumerable func_enum = Map1.GetFunctionalities();
 3
 4foreach (ESRI.ArcGIS.ADF.Web.DataSources.IGISFunctionality gisfunctionality in func_enum)
 5{            
 6    if (gisfunctionality is ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapFunctionality)
 7    {
 8        ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapFunctionality agssoap_mf;
 9        agssoap_mf = (ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapFunctionality)gisfunctionality;
10
11        ESRI.ArcGIS.ADF.ArcGISServer.MapDescription agssoap_md = agssoap_mf.MapDescription;
12        
13        ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapResourceBase agssoap_mr = agssoap_mf.MapResource;
14
15        // Working with the same map server proxy and Value objects generated from ArcGIS Server
16        // map service WSDL
17        ESRI.ArcGIS.ADF.ArcGISServer.MapServerProxy msp = agssoap_mr.MapServerProxy;
18        ESRI.ArcGIS.ADF.ArcGISServer.MapServerInfo msi = msp.GetServerInfo(msp.GetDefaultMapName());
19        ESRI.ArcGIS.ADF.ArcGISServer.MapLayerInfo[] mlis;
20        mlis = agssoap_mr.MapServerInfo.MapLayerInfos;
21        ESRI.ArcGIS.ADF.ArcGISServer.LayerDescription[] ldescs;
22        ldescs = agssoap_md.LayerDescriptions;
23        for (int i = 0; i < mlis.Length; i++)
24        {
25            ESRI.ArcGIS.ADF.ArcGISServer.MapLayerInfo mli = mlis[i];
26            ESRI.ArcGIS.ADF.ArcGISServer.LayerDescription ldesc = ldescs[i];
27        }

28    }

29}

30  
posted @ 2008-03-28 15:12  GIS小能  阅读(1026)  评论(0编辑  收藏  举报