Visual Basic (Declaration) | |
---|---|
Public NotInheritable Class ArcGISWebClient |
C# | |
---|---|
public sealed class ArcGISWebClient |
ArcGISWebClient is used to communicate (read and write) information with a web server. It is specially designed and optimized to communicate with ArcGIS Server.
Silverlight, WPF and Windows Phone all have subtle differences in communicating between clients and servers over the Internet. The ArcGISWebClient minimizes those differences and allows for a more common/standardized experience in the client/server communications. The following are some examples of things handled by the ArcGISWebClient that a developer would have to write extensive coding logic to handle if using the Microsoft System.Net.WebClient Class to communicate with ArcGIS Server:
- Automatically handle switching from GET to POST communications when the 256 character limitation is reached by passing a Url in the address bar of the client to a web server.
- Automatically using GZIP to deflate headers for large responses coming back from the ArcGIS Server to the client application for optimal download performance.
- Automatically handle and decode errors from ArcGIS Server so that they can more easily be dealt with and accommodated for.
- Allow downloading strings and/or data from an ArcGIS server by leveraging the IdentityManager Class for secure communications.
- Enables accessing secured ArcGIS Server web services via PKI security with Client Certificate credentials.
Most of the time, ArcGIS developers use the other classes in the API to perform this GIS/mapping operations. For those developers who want more control or want to enhance the existing ArcGIS API, the ArcGISWebRequest Class provides a starting point. Examples of building your own API classes could include: creating your own QueryTask or Identify functionality; interrogating specifics of a FeatureLayer that is not handled by existing API classes; or browse the contents of an ArcGIS Server for a custom navigation experience rather than using the ArcGIS Server Directory pages.
The ArcGISWebClient.DisableClientCaching Property when true forces the ArcGIS Server to provide fresh data back to the client and appends a timestamp ( _ts ) to all return Urls. The default value for the ArcGISWebClient.DisableClientCaching is false.
Use the ArcGISWebClient.DownloadStringAsync Method / ArcGISWebClient.DownloadStringCompleted Event to process (read/write) text such as: JSON, XAML, XML, and HTML.
Use the ArcGISWebClient.OpenReadAsync Method / ArcGISWebClient.OpenReadCompleted Event to process (read/write) binary streams of data such as: images, files (.doc, .pdf, .exe), music, movies, etc.
Concurrent asynchronous calls are not supported using the ArcGISWebClient class. This means that it is not possible to have multiple ArcGISWebClient operations to return results from ArcGIS Server. Use the ArcGISWebClient.IsBusy Property to determine if an existing operation is running before issuing the ArcGISWebClient.DownloadStringAsync or ArcGISWebClient.OpenReadAsync Methods to avoid the Visual Studio runtime error: NotSupportedException was unhandled by user code. "Request does not support concurrent I/O operations."
For token based secured services, the ArcGISWebClient does not automatically activate the Identity Manager. If needed, the IdentityManager Class should be activated before using ArcGISWebClient. If the IdentityManager is not active, ArcGISWebClient will work but you will have to address the error message similar to the following: Unauthorized access error code 499.
TIP: Use the shareware/freeware application Fiddler to look at what is being sent for the various parameters when communicating with ArcGIS Server to understand how to pass in the various arguments of the ArcGISWebClient.DownloadStringAsync and ArcGISWebClient.OpenReadAsync Methods. Developers will want to use the documentation in the ArcGIS Server REST API to understand what the exact syntax of the Url and parameters needed to be passed into the ArcGISWebClient.DownloadStringAsync and ArcGISWebClient.OpenReadAsync Methods. For example: http://services.arcgisonline.com/ArcGIS/SDK/REST/index.html is the location of the Esri's ArcGIS Server REST API documentation available for the public.
System.Object
ESRI.ArcGIS.Client.ArcGISWebClient
Target Platforms: Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family, Windows 7, Windows 8