Querying ArcGIS Server Web Services
One of the ways to connect to ArcGIS Server is through Web services. When you make an Internet connection to the server, you will use a URL in this format: http://<server name>/<instance name>/services
This is an endpoint to your ArcGIS Server service catalog url.
Where <server name> is the name of your server, which can be an IP address, a domain name (serverx.esri.com), or simply "localhost". The <instance name> is the name of your ArcGIS Server instance. The instance gets defined when you install ArcGIS server. You can review it by looking at server properties at your root folder in ArcCatalog.
So what can I do with this services catalog URL? This URL can be used to establish an Internet connection to an ArcGIS Server instance in ArcCatalog. It can be used as a connection in the ArcGIS Server Web ADF. It can also be used in custom applications that work with Web services. Today I am going to build a simple web application using the Microsoft .NET Framework in ASP.NET that consumes the catalog URL for my ArcGIS Server instance and lists the services, types, and service URL in a simple web page.
The first step after creating your new web site is to register the services catalog URL for your ArcGIS Server Web service. To do this you need to add a web reference to your project (in VS2005 right click on the project name and Add Web Reference). In the web reference dialog enter your server catalog URL.

Once we have registered the Web service we just need to use it.
//Create an instance of the service catalog web service
WebCatalog.Catalog webCat = new WebCatalog.Catalog();
//Set the url to your ArcGIS Server services url
String serverUrl = "http://localhost/arcgis/services";
webCat.Url = serverUrl;
//Get the all the service descriptions from the Catalog
WebCatalog.ServiceDescription[] sds = webCat.GetServiceDescriptions();
//extract the name, type, and URL for each service in the
//servicedescriptions array
foreach (WebCatalog.ServiceDescription sd in sds)
{
Response.Write("<b>Service Name</b> = " + sd.Name + "<br>");
Response.Write("<b>Service Type = </b>" + sd.Type + "<br>");
Response.Write("<b>Service URL = </b>" + sd.Name + "<br>");
Response.Write("<br><hr>");
}
So try it out here: http://serverx.esri.com/InterrorgateServer
You can download the Visual Studio project here.
Over the next few weeks I will explore working with the Web services for some of the ArcGIS Server service types (MapServer, GPServer).
Jeremy