Vishful thinking…

HTTP header status

Posted in Uncategorized by viswaug on November 26, 2008

We have been building a completely RESTful interface for editing data served up by the ArcGIS Server MapServices. It is a supplement to the ESRI REST services which does not expose all the functionality that we need through its REST API. It has turned out great so far and has been amazingly easy to work with when building applications using the JS API. One of the important things to keep in mind when building RESTful interfaces to your data is to abide the REST principles. So, being true to the REST principles, we need to respond to the HTTP requests that produce an error on the server when processing it with the corresponding HTTP status headers. It is tricky to walk through all those conditions in your head and decide on the correct HTTP status that needs to be returned. Well, this flowchart below from Alan Dean should help with process and make it easier to figure out what status code to return.

http-headers-status

 

We also have built a JavaScript “Table of Contents (TOC)” control built for the ESRI JS API which uses a custom RESTful service on the back-end to return all the data needed to build the Table of Contents. We also use the ArcGIS Server SOAP API in our TOC REST service to get the data and the swatches for the Table of Content. Which should allow us to deploy the TOC REST service on any web server without needing a server license. I hope to be posting a link to a working demo of the Table of Contents component pretty soon. In the meanwhile, if you are building a Table of Contents component yourself, one bit of advise that you might consider is to leverage the ASP.NET cache to store the response for the TOC data. Depending on the complexity of your MapService, the response from ArcGIS Server when requesting map legend data could range from long to extra-ordinarily long. In the case of our MapService, when requesting the map legend data from ArcGIS Server, the response took 7 seconds on an average. But the response from our TOC REST service almost take no time at all once it has been cached in the ASP.NET cache.

2 Responses

Subscribe to comments with RSS.

  1. Dave said, on November 26, 2008 at 5:09 am

    Vish,

    Sounds really cool! Are you building on ASP.NET Handlers or MVC, or some other Vish-mystery goodness?

    Cheers,

    Dave

  2. viswaug said, on November 26, 2008 at 3:14 pm

    Hi Dave,

    We have been adopting the SOA design guidelines wherever possible and the REST services we have been writing are WCF REST services.

    Thank You,
    Vish


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: