In the weekly newsletter from TheServerSide.NET, there was a link to an article titled “REST versus SOAP – the REST story” by William Brogden.  It’s a few months old, but talk about the recent rise in REST types of services over XML-RPC and SOAP.   Brogden briefly covers REST, but he doesn’t talk about the advantages of REST and why you would ever want to use it over SOAP.  It’s obvious that he prefers SOAP, but the reasoning was left out of the article.

Having done SOAP and REST for accessing web services, I can see the where it’s advantageous to use SOAP as opposed to REST (or vice versa).  SOAP is very chatty, but you can send complex data structures to the web service.  Development tools like Visual Studio or Delphi can can read the WSDL from the web service and that gives you the “intellisense” autocompletion functionality that can save a lot of coding time.

With REST, you access the web service with just the basic HTTP GET and PUT commands.  You compose a URL for your web method request and the service sends back a response.  The response is usually in XML, but that is dependant on the functionality of the web service.

The drawback with SOAP is that there is more overhead in the construction of the method request and with the parsing of the request on the web service end.  When you have a web service that is serving thousands of requests a minute or second, that overheard may not be needed.

For web services that have relatively simple data types, using REST can provide the functionality that is needed.  You also get the advantage of testing individual method requests from a browser as the method request is basic URL. 

Tech Tags: