How to connect to an ArcIMS service


Summary This topic demonstrates how to connect to an ArcIMS service. The IMSServerConnection abstract base class is implemented by the TCPConnection and HTTPConnection classes, to connect via TCP and HTTP respectively. TCP connections must be made to the ArcIMS Application Server. HTTP connection must use the can use both the ArcIMS Servlet connector and the ASP.NET ArcXMLHandler, included with the ArcIMS API, can serve as endpoints. A reference to a map service is maintained when creating a new MapService instance. A set of initialization parameters can also be provided to define service capabilities. Once a reference to the map service is available, you can create a MapView to work with map service content, such as generating a map image or querying a layer.

  1. Set up an application with the listed assemblies.
  2. Set the properties of a TCP or HTTP connection to the appropriate values.
[C#]
// Using the ArcGIS Connection library - TCP
ESRI.ArcGIS.ADF.Connection.IMS.TCPConnection tcpConnection = new
    ESRI.ArcGIS.ADF.Connection.IMS.TCPConnection(serverName, 5300);
tcpConnection.ServiceName = serviceName;

// Using the ArcIMS Connection library - HTTP
ESRI.ArcGIS.ADF.Connection.IMS.HTTPConnection httpConnection = new
    ESRI.ArcGIS.ADF.Connection.IMS.HTTPConnection("http://webservername");
httpConnection.ServiceName = serviceName;

// Using the ArcIMS API
ESRI.ArcGIS.ADF.IMS.Carto.MapService mapService = new
    ESRI.ArcGIS.ADF.IMS.Carto.MapService(tcpConnection, new
    ESRI.ArcGIS.ADF.IMS.Carto.InitializationParameters(), true);
ESRI.ArcGIS.ADF.IMS.Carto.MapView mapView = mapService.CreateMapView();
[VB.NET]
' Using the ArcGIS Connection library - TCP
Dim tcpConnection As ESRI.ArcGIS.ADF.Connection.IMS.TCPConnection = New ESRI.ArcGIS.ADF.Connection.IMS.TCPConnection(serverName, 5300)
tcpConnection.ServiceName = serviceName

' Using the ArcIMS Connection library - HTTP
Dim httpConnection As ESRI.ArcGIS.ADF.Connection.IMS.HTTPConnection = New ESRI.ArcGIS.ADF.Connection.IMS.HTTPConnection("http://webservername")
httpConnection.ServiceName = serviceName

' Using the ArcIMS API
Dim mapService As ESRI.ArcGIS.ADF.IMS.Carto.MapService = New ESRI.ArcGIS.ADF.IMS.Carto.MapService(tcpConnection, New ESRI.ArcGIS.ADF.IMS.Carto.InitializationParameters(), True)
Dim mapView As ESRI.ArcGIS.ADF.IMS.Carto.MapView = mapService.CreateMapView()






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):