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
 

 

 

This entry was posted in Services and tagged , , . Bookmark the permalink.

Leave a Reply

6 Comments

  1. Jeremy says:

    Thanks Brian! I appreciate your comments. You hit the nail on the head.

    Cheers,
    Jeremy

  2. Jeremy says:

    Hi Simon,

    Can you view the service in ArcCatalog via an Internet resource? In ArcCatalog…Add ArcGIS Server, select the Use GIS Services option, and enter your web service URL in the Server URL box.

    Thanks,
    Jeremy

  3. Bryan Baker says:

    Simon,

    If I understand your situation, you can use ArcGIS Server services as Local services, but not as Web services. The identity error suggests that the account used to run the ArcGIS Web Services is not being recognized correctly.

    Some things to look at or try:
    – Re-run the ArcGIS Server Web Applications Post-installation (in the Start menu), and in the dialog for the GIS Server Web Services Account, choose to create a New Local Account, and enter a new account name and password. Finish the post-install, restart IIS, and see if that allows you to connect to Internet services.
    – Try viewing the WSDL document for your web service in a browser, along these lines:
    http:///arcgis/services//MapServer?wsdl

    If that gives you a lengthy XML document in the browser, then the web service is working.

    A number of other things could cause the Web services to fail. I’d suggest contacting ESRI Support (or your local distributor if outside the United States) if you cannot get this working.

  4. jschek says:

    When will actual, formal documetnation on the web services be published?

  5. swanner says:

    After you run the AGS Web Apps Post Install, the GIS Server Web Services account needs to be in the agsusers group, not just agsadmin.