Tuesday, February 23, 2010

Its Enough SOAP, Lets take some REST

Microsoft has been widely promoting SOAP (Simple Object Access Protocol) since its inception. They did hold strong reasons to do that.

1. It is firewall friendly.
2. It has great tooling support across vendors.
3. It is interoperable (with some XML payload, ofcourse).

But WHY REST?

Now there's nothing like i'm trying to defend REST or criticize SOAP, But there are few things about SOAP which makes it feel low against REST.(source : Tech-Ed session by Sanjay Vyas) They are :-

1. SOAP uses only POST method (now i don't need to explain wht POST is...), & hence it is not cacheable.

2. SOAP defines one endpoint and many actions are attached to this endpoint (It uses a process-centric approach, focusing on having different methods assigned to a single endpoint) unlike REST.

3. SOAP messages has different styles like RPC-Encoded, RPC-Literal OR
Document-Encoded, Document-Literal(allowing you to structure you SOAP messages anyway you like). In other words, SOAP does not have a finite standard.


So What is REST?

Its not a protocol, not a set of API, Its also not a technology and not another SOAP style either.

REST is an architectural style which fully leverages the simplicity, pervasiveness & scalability of the Web.

It has a Resource-Centric approach or URI-based approach towards accessing services available on the Web.(which means it simply uses uris for accessing services over web, which makes the approach more intuitive & easier).

No comments: