Monday, June 2, 2008

Differences between SOAP and REST

This article compares SOAP style web services with REST style web services. It highlights key business areas where REST scores over SOAP. The idea here is not to belittle SOAP which has been a strong pillar of distributed computing over the past decade but to bring its dark side to light.
SOAPREST
SOAP clients call every SOAP operation on the server using only Http GETREST clients leverage true functionality of HTTP methods like GET,POST,PUT and DELETE and use them to call the REST service
SOAP is operation centricREST is resource centric
SOAP mandates the use of WSDL and proxies on all the clients which need to call SOAP web serviceREST call be called from any client on any platform with using any proxy or WSDL
If SOAP WS Interface changes, you need to update proxies on the all clients which are hooked to that SOAP WSREST services doesn't have this limitation
SOAP puts overhead of and on the XML dataREST doesn't put any such overhead
Stateful SOAP services are not scalableREST services are stateless by design so they are scalable
Stateful SOAP services create much headache in Load-balanced environmentBecause REST is fundamentally stateless, this headache doesn't arises
SOAP objects are not cache-ableREST Uris are cache-able
SOAP puts additional overhead of SoapBody and SoapEnvelope which is considerable for low bandwidth clients like PDAs, Smartphones, etcREST doesn't have this limitation
SOAP is slower because it consumes time parsing XML and serializing objectsREST is faster because its simpler and doesn't have such schema dependencies
SOAP has a bigger learning curve as developers need to fully understand WSDL, UDDI, WS-*REST has very shorter learning curve as it extends directly from HTML

Despite these limitations SOAP is still the first choice when it comes to Reliable, Secure and Transactional Web Services. So each side has its pros and cons but REST is certainly more than it is thought to be.

No comments: