.NET proxy libraries
In general, each development environment has at least one SOAP toolkit which can generate a native client library from one or more service WSDLs. With ArcGIS Server, you can generate the proxy classes once and reuse them with other services of the same type. As a result, it may be most efficient to generate a single library for all ArcGIS Server service types at one time and redistribute for use in all your applications. In this document you'll find the steps necessary to generate a shared library for the Microsoft .NET Framework and be able to download a pre-generated library you can use immediately in your application.
Downloading the .NET SOAP Proxy Library
Download the .NET SOAP Proxy Library
Click on the link above to download a zip file which contains a .NET library (ESRI.ArcGIS.SOAP.dll) and two batch files you can use to generate the library. If accessing this page from the file system, right-click and select Save As. The .NET library contains ArcGIS SOAP Web service proxies and shared value objects for all ArcGIS Server service types. Globe and Mobile service types are excluded since they are explicitly designed for ArcGIS Desktop or Mobile clients.
Using the Proxy Library in your .NET Framework application project
- Add a reference to the core .NET System.Web.dll
- Add a reference to the ESRI.ArcGIS.SOAP.dll
- Add a service proxy in your code. Use the table below to
determine which proxy class you need depending on the type of
service you want to work with.
Service type
Proxy name
Catalog
ServiceCatalogProxy
Feature
FeatureServiceProxy
Geocode
GeocodeServerProxy
GeoData
GeoDataServerProxy
Geometry
GeometryServerProxy
Geoprocessing
GPServerProxy
Image
ImageServerProxy
Map
MapServerProxy
Network Analysis
NAServerProxy
- Define the URL property on the service proxy. Reference the service endpoint you want to use. Call methods on the proxy to interact with the service. For example: ESRI.ArcGIS.SOAP.MapServiceProxy mapServiceProxy = new ESRI.ArcGIS.SOAP.MapServiceProxy(); mapServiceProxy.Url = "http://serverapps.esri.com/arcgis/services/California/MapServer"; string mapName = mapServiceProxy.GetDefaultMapName();
Generating custom proxy classes
To generate your own proxy classes, use the batch files included with the download above as a guide. One batch file, generatesharedALL_File.bat, uses WSDLs on the file system to generate proxy classes. The other batch file, generatesharedALL_Url.bat, uses WSDLs available via HTTP endpoints to generate proxy classes. The benefit of using WSDLs on the file system is two fold: 1) You do not need a create a service to generate the proxy classes and 2) You can easily define the proxy class name and default url.
Generating fully functional proxy classes requires the use of a SOAP toolkit. The Microsoft .NET SDK includes a SOAP Toolkit utility named wsdl.exe. Use the following table as a guide to the input parameters for the utility:
Parameter |
Description |
---|---|
/sharetypes |
Create one type for all common type definitions in each defined wsdl |
/language:CS |
The language of the class file generated by this command. |
/namespace:ESRI.ArcGIS.SOAP |
The namespace of the proxies and value object types in the generated class file. |
/out:.\ESRI.ArcGIS.SOAP.cs |
The name of the class file containing the proxies and value objects generated from each defined wsdl |
/protocol:SOAP |
The protocol format of the Web requests generated by the proxies and value objects. |
*.wsdl |
The path or url to one or more wsdls used to generate native .NET class file. |
To use WSDLs on the file system, do the following:
- Copy the WSDL files for the service types of interest from %ArcGIS Install%\XmlSchema to a location of your choice.
- In a text editor, open a WSDL and scroll to the bottom of the text. Change the #NAME# parameter to the name of the proxy class for the service (e.g. MapServerProxy).
- At the same location in the WSDL file, change the #URL# parameter to the default Url for the proxy class. It can be a dummy url (e.g. http://localhost:6080).
- Repeat this process for each service type of interest.
- Use wsdl.exe to generate the class file. Optionally you can use a command line compiler (e.g. csc) to generate a library.