TechBubbles Microsoft Technology BLOG

REST and SOAP

Which is better SOAP or REST? One of the most common discussions. Both REST and SOAP are different approaches in writing the service oriented applications. REST is an architectural style for building client-server applications. SOAP is a protocol for exchanging data between two endpoints.

                                                    webservice

It is more appropriate if you compare REST with RPC(remote procedure call). RPC is a style of building client-server applications. Compared to RPC there won’t be generated proxy for client which is less coupled to the service.

REST relies on HTTP, requests for data[Get requests] can be cached. RPC systems not having such infrastructure even when using SOAP over HTTP.

Both REST and SOAP can used to implement similar functionality but SOAP should be used when a particular feature of SOAP is needed.

Security 

Is SOAP is more secured than REST? answer is no. It is easy to make REST based service secure as it is to make SOAP service.The security in REST  is in the form of HTTP-based authentication and Secure Sockets Layer(SSL).  Because of WS-* specifications SOAP supports the end-to-end message security.

Transactions

This is another feature that SOAP and WS-*  supports where REST has none.

WS-Atomic transactions supports distributed, two-phase commit transactional semantics over SOAP-based services. REST has no support for distributed transactions. To create something like transactions in REST you create a  resource called Transaction. When client wants to do some transaction and then he creates a resource that specifies all the correct resources.

Interoperability 

SOAP services are less interoperable than REST Services. In terms of platforms, For REST all you need is HTTP stack. REST has widest interoperability like mobile devices,household devices, POS devices etc. The problem in SOAP and WS-* is the large number of standards to choose from.

Metadata

There is no direct way in REST to generating client from server-side-generated metadata. In SOAP with WSDL we can generate the client proxies. In REST we can achieve the same using WADL (Web Application Description Language). WSDL makes easier in generating the proxy than writing some code fro generating for REST service.

Protocol Support

Though REST is currently tied with HTTP but you still can implement the REST features on other protocols until vendors add support for this.

IS REST is for Internet-facing apps and SOAP for enterprise apps?

Answer is no. This question comes due to lack of distributed transaction support in REST vs explicit WS-atomic transactions in SOAP.

ASP.NET doesn’t have support for distributed transactions, but does that mean ASP.NET isn’t useful for enterprises?

Enterprise applications need scalability and speed. SOAP services are much harder to scale than RESTful services. Most of the scaling features can not be used with SOAP because SOAP uses POST only over HTTP.

Conclusion

“Which is better, REST or SOAP?” is “It depends”. Both REST and SOAP has advantages and disadvantages when it comes to building the services. When you need the features that are easy to implement using REST or SOAP choose it…..

SOURCE: www.masteringbiztalk.com

About the author

Kalyan Bandarupalli

My name is kalyan, I am a software architect and builds the applications using Microsoft .NET technologies. Here I am trying to share what I feel and what I think with whoever comes along wandering to Internet home of mine.I hope that this page and its contents will speak for me and that is the reason I am not going to say anything specially about my self here.

2 Comments

  • Good job, I just read a couple of your posts and got a decent understanding between regular web services of .net 2.0, and the wcf, and vcf REST services introduced in 3.5. Best Regards.

  • Hello i am developing an Android Application with KSOAP and i was wandering , how much faster can REST Web Services bee thatn SOAP when connecting with Android Devices ?
    Will there be a difference ?
    I prefer SOAP Web services because i have been Developing on them for very long time.
    Rest Web services are something new to me , but if this means that the application may be 50 % more efficient and Fast then i should start working with them .
    Best Regards…

TechBubbles Microsoft Technology BLOG

Follow me

Archives

Tag Cloud