Showing posts with label REST. Show all posts
Showing posts with label REST. Show all posts

Saturday, 25 August 2007

When to use REST and when to use SOAP

There are so many pages and blogs on REST vs SOAP that a person like me who wants to know which one to use where, simply gets confused. These blogs and pages talk more about pros and cons of REST and/or SOAP, while I believe every such thing has a place in a particular scenario. In other words, REST will be applicable (please note I am not saying better!) in some cases, while SOAP will be applicable in some other cases. Fortunately, I found this article by Sameer Tyagi, which gives good advice on when to use REST and when to use SOAP. Let me quickly outline my understanding of Sameer's article in this blog.

A RESTful design may be appropriate when
  • Completely stateless web services are needed.
  • A caching infrastructure can be leveraged.
  • The requirement is for point-to-point integration. This means both service consumer and provider have mutual understanding of the context and content being passed.
  • Limited bandwidth exists between service consumer and provider; e.g. having mobile device as a consumer.
  • Front-end technologies such as AJAX and DWR are being used.
A SOAP-based design may be appropriate when
  • A formal contract is needed for a service (to be provided as WSDL).
  • Complex non-functional (aka QoS) requirements are present and need to be handled in a standardized way.
  • Requirements for asynchronous service invocation are present.
Now this kind of information comes handy when a solution is to be proposed for a particular case.