Working with data sources


In this topic


About working with data sources

Web Application Developer Framework (ADF) controls consolidate and utilize data from multiple sources, such as the following:
  • ArcGIS Server services accessed through local or Internet connections
  • ArcIMS services
  • Web Map Service (WMS) services
  • Bing Maps services
  • Web ADF graphics data sources
Local (DCOM) connections are only supported for ArcGIS Server versions prior to 10.1.
One of the main benefits of the Web ADF is the ability to display maps generated by one or more data sources at the same time, consolidated in a Map control. Web ADF components utilize data sources as resources. The capabilities of a data source determine the type of resource and subsequent functionalities it can provide.
Every available data source in the Web ADF is, in essence, a custom data source, plugged into the Web ADF via implementation of the Web ADF Common Data Source application programming interface (API [the Common API]). In most cases, each data source has a data source-specific API that can be used independently. To be used as a resource in the Web ADF, the data source must implement the appropriate Common API interfaces and classes. The capabilities of the data source dictate which interfaces and classes are appropriate. For example, the ESRI.ArcGIS.ADF.ArcGISServer assembly contains the Simple Object Access Protocol (SOAP) proxies and value objects associated with the ArcGIS Server SOAP API. It can be used independently, outside the Web ADF controls and API to work with ArcGIS Server services.
To use ArcGIS Server services as data sources in the Web ADF, a Common API implementation of the ArcGIS Server SOAP API is provided in the ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer assembly. The Web ADF uses this ArcGIS Server implementation of the Common API to utilize ArcGIS Server data sources, both local and Internet.
Each data source that is supported out of the box with the Web ADF has its own library, prefixed with ESRI.ArcGIS.ADF.Web.DataSources. The data source implementation libraries contain resource and functionality classes that provide access to basic capabilities of the data source. For example, if a data source can generate a map, it supports MapResource and MapFunctionality. Developers use the Map control and MapResource to create a MapFunctionality to generate a map.
Some data sources have more capabilities than others. For fine-grained tasks, the MapFunctionality class contains a hook into a data source-specific API corresponding with the data source type. The ArcGIS Server SOAP API and the ArcIMS API are two examples of lower-level APIs that provide data source-specific, fine-grained capabilities.
When adding data to a Web ADF application, it is important to understand the limitations of each data source and how the data is added. From the Web ADF perspective, you have the following options when adding data dynamically at run time:
  • Add a data source as a new Web ADF resource—This is a relatively coarse-grained operation where the Web ADF API is used to add a new resource item to a resource manager. This can be accomplished at design time using a resource manager control or programmatically at run time. The Web ADF is solely responsible for integrating and managing the new resource item with existing resources. For more information, see Resources and functionalities in the Web ADF.
  • Add a layer to the data source of an existing Web ADF resource—This is a fine-grained operation supported by the use of a data source-specific API. A new layer (feature or image) is added to an existing data source at the data service level. For example, a dynamic layer can be added to an existing ArcIMS or ArcGIS Server map service (local connections only). In some cases, the state dynamic layer can be managed by the Web ADF (ArcIMS). In other cases, you must explicitly manage the change (ArcGIS Server local) because it involves a stateful change to the service. For more information, see the following samples, ArcIMS Add dynamic data and ArcGIS Add dynamic data

ArcGIS Server local

An ArcGIS Server local data source represents a local area network (LAN) connection to an ArcGIS Server service via the server object manager (SOM). To connect, provide the name of the server and service you want to connect to, with identity information that verifies you are a member of the agsusers or agsadmin group on the machine where the SOM is installed.
ArcGIS Server local data sources provide access to pooled and non-pooled ArcGIS Server map, image, geocode, and geoprocessing services. Local data sources enable you to work with fine-grained ArcObjects via server context. ArcObjects capabilities—such as editing feature layers, solving network solutions, or projecting geometry—can be leveraged and utilized in a Web ADF application. In addition, the SOM leverages only Windows local and Windows NT domain users and groups for "all or nothing" access to services. As a result, ArcGIS Server local data sources use the identity of the Web application to authenticate access to ArcGIS Server services. Only one Web application identity is permitted; therefore, the defined identity must have access to all ArcGIS Server local data sources. For more information on setting the Web application identity, see Visual Studio 2008/2010 integration.
To work with an ArcGIS Server local data source programmatically, use the ArcGIS Server data source implementation library ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer. From the MapFunctionality class of this assembly, you can access the map description and work with the ArcGIS Server SOAP API. An ArcGIS Server local resource (for example, MapResourceLocal) provides access to server context via the ServerContextInfo.ServerContext property. In general, resource classes that work with ArcGIS Server local data sources include the suffix "Local" in a class name. For example, the MapResourceLocal class works with ArcGIS Server local data sources in the Web ADF. If you are working with non-pooled services, you must explicitly release server context. For more information, see the Managing server context section of the ArcGIS Server implementation in the Web ADF topic.
ArcGIS Server local data sources and ArcGIS Server Internet data sources can utilize cached map services. For more information on caching, see the topics under the Creating ArcGIS Server Solutions, Managing your GIS Server, Publishing Services, and Caching Services nodes in the table of contents (TOC) in this Help system.
For more information on ArcGIS Server (local and Internet) implementation in the 9.3 multisource Web ADF, see ArcGIS Server implementation in the Web ADF.

ArcGIS Server Internet

Selecting an ArcGIS Server Internet data source implies that the client accesses an ArcGIS Server service through a Web service endpoint. An ArcGIS Server Web service provides access to the ArcGIS Server SOAP API via a Web Service Description Language (WSDL), which can be used by a client to generate value objects and proxies in a native development environment. For ArcGIS Server services, the SOAP API only exposes a subset of stateless functionality available via ArcObjects. As a result, ArcGIS Server Internet data sources work with ArcGIS Server services in a stateless manner. Server context is not available via an ArcGIS Server Internet data source, so fine-grained ArcObjects capabilities are not available also. Since ArcGIS Server Web services can utilize authentication enabled on a Web server, multiple Internet data sources with different authentication credentials can be used in the same Web application.

Secured services

ArcGIS Server Internet data sources can be used as map, image, geocode, and geoprocessing resources. In a resource manager, when specifying the definition of an ArcGIS Server Internet connection, provide the uniform resource locator (URL) for the server that contains the service, then select the service you want to view from the drop-down box. If authentication is enabled on the site, add a username, password, and domain before connecting. For more information on secured services, see ASP.NET security.

Pooled services

Ensure that the ArcGIS Internet data sources you use are pooled geographic information system (GIS) services. Pooled services are shared among users of the Web application. Non-pooled service instances (processes) are dedicated to a single user, and the instance is destroyed after the user finishes with it. If you use a non-pooled service in an Internet connection, a new process is created and destroyed with every map or other GIS operation. This leads to inefficient use of resources on the GIS server and contributes nothing to the application. If necessary, contact the GIS server administrator to ensure that Internet services used in the application are set to pooled status. For more information on pooling services, see the topics under the Creating ArcGIS Server Solutions, Managing your GIS Server, Publishing Services, How to publish services, and Tuning and configuring services nodes in the TOC in this Help system.

Web services

To work with an ArcGIS Server Internet data source programmatically, use the ArcGIS Server data source implementation library ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer. This library contains functionality classes as do other data source libraries. It also contains other classes for performing fine-grained tasks in a stateless environment. In general, resource classes that work with ArcGIS Server Internet data sources include the suffix "Internet" in a class name. For example, the MapResourceInternet class works with ArcGIS Server Internet data sources in the Web ADF. Both local and Internet data source implementations use the ArcGIS Server SOAP API to work with an ArcGIS Server service. The ArcGIS Server service proxies (Web server and Distributed Component Object Model [DCOM]) and value objects are contained in the ESRI.ArcGIS.ADF.ArcGISServer library. To serve data via a Web service, create a server object, then use the Web Service Publisher to create the Web service. For more information, see the topics under the Creating ArcGIS Server Solutions, Managing your GIS Server, Publishing Services, How to publish services, and Publishing a GIS resource to the server nodes in the TOC in this Help system.

Bing Maps

Microsoft's Bing Maps services platform (formerly known as Virtual Earth) offers access to map imagery and data as well as search, location, and routing services. The Web ADF enables the integration of Bing Maps data and services in ADF applications through the implementation of the Common API in the ESRI.ArcGIS.ADF.Web.DataSources.VirtualEarthService library. Access to the Bing Maps requires a Bing Maps developer account. If you have purchased a Bing Maps license with ArcGIS Server, check with your ArcGIS Server administrator for the Bing Maps account ID and password to use with the ADF. If an existing license is not available, contact ESRI customer service to create an account. Use of Bing Maps services in the Web ADF requires that you provide an account ID and password when utilizing a Bing Maps resource item.
Bing Maps services are hosted in staging and production environments. By default, once you have a valid Bing Maps account ID and password, you can work with the staging environment to support development and testing. Map imagery contains a watermark to indicate that staging services are being used. To access the production environment, you must be a licensed customer.
Bing Maps imagery is only provided in the Web Mercator coordinate system and cannot be reprojected on-the-fly.
Microsoft's Bing Maps API Terms of Use specifies that all Bing Maps Geocode service results must be displayed on a Bing Maps basemap.

ArcIMS

Selecting an ArcIMS data source implies that a client accesses either Transmission Control Protocol (TCP) or Hypertext Transfer Protocol (HTTP). For TCP connections, specify the host and port number of the ArcIMS Application Server. For HTTP connections, specify the URL to the ArcIMS servlet connector. Both image and ArcMap image services are supported as map resources. Geocode capabilities exposed in an image service are supported as geocode resources.
To work with an ArcIMS data source programmatically, start with the ArcIMS data source implementation library, ESRI.ArcGIS.ADF.Web.DataSources.IMS. Through the MapFunctionality class in this library, you can access a MapView class in the Web ADF's ArcIMS API ESRI.ArcGIS.ADF.IMS. Almost all fine-grained functionality available via ArcXML is exposed through the ArcIMS API. For more information, see Working with the ArcIMS API.

OGC WMS services

The Web ADF controls support services that implement the OpenGIS Consortium (OGC) WMS specifications. To add an OGC WMS service to your application, you need to know the URL of the service to which you want to connect. Only map resources are supported. When you set the definition information in the MapResourceManager, a dialog box allows you to add an endpoint to a single WMS service. The service can contain multiple layers, which are referenced in the URL with the services argument and a unique ID for each layer. By default, all layers are added to the URL.
To serve data as a WMS service, you can create an ArcGIS Server map service with the WMS capability enabled. See the ArcGIS Server Help system for more information on publishing map services and enabling capabilities. You can also use ArcIMS to publish services that comply with WMS specifications.
The following are WMS endpoint examples:
  • ArcGIS Server WMS services—http://<hostname>/arcgis/services/<servicename>/MapServer/WMSServer
  • ArcIMS WMS services—http://<hostname>/wmsconnector/com.esri.wms.Esrimap/<servicename>
  • CGI enabled WMS services—http://<hostname>/cgi-bin/customwms

Graphics layers

You can use a graphics layer to efficiently display geographic features at the Web tier. These features might or might not originate from one of the services previously mentioned. For example, you might have used an existing service on your map to return a table of point geometries from a geocoding operation, or you might have used your Global Positioning System (GPS) unit to collect a set of waypoints. In either case, you can render these features in a graphics layer.
The Web ADF provides a graphics data source unique to the Web ADF. The graphics data source can be added as a map resource item of type GraphicsLayer to a MapResourceManager and displayed in an associated Map control. A Web ADF graphics resource is a type of System.Data.DataSet, which can hold many DataTables. You can access the Web ADF GraphicsDataSet via the Graphics property on a Graphics map resource.
The Web ADF also defines two graphics layer types, ElementGraphicsLayer and FeatureGraphicsLayer. Both layers are a type of System.Data.DataTable. Thus, they can be added to the GraphicsDataSet Tables collection. Graphics layer content is stored in-memory by the Web application. As a result, the amount of content in a graphics layer is proportional to the amount of memory required for the Web application.
Graphics layer types must be created and managed programmatically.
ElementGraphicsLayers store basic graphic elements, namely geometry and a symbol. One ElementGraphicsLayer can store different types of geometry. In general, they do not store attributes. They are often used to display selected features in a map.
FeatureGraphicsLayers emulate a true feature layer. Each layer supports only one geometry type. Web ADF renderers can be applied to symbolize geometry based on attribute values in the DataTable. FeatureGraphicsLayers also support queries.
The Web ADF handles drawing each graphics layer type within a Graphics Layer resource. As a result, the Web ADF also provides a set of geometry types, symbols, and renderers that can be used with graphics layer types. Web ADF symbology supports variable transparency (0 percent through 100 percent). For more information about graphics in the Web ADF, see Working with graphics.

Creating custom data sources

The multi-service architecture of the Web ADF has the flexibility to use custom data sources. In general, all data sources that are supported out-of-the-box by the Web ADF are custom, because they are required to implement the Common API and are located in the ESRI.ArcGIS.ADF.Web.DataSources library. For more information on creating and implementing a custom data source in the Web ADF, see Creating custom data sources.