SOAP and REST web service comparison

SOAP stands for Simple Object Access Protocol. REST stands for Representational State Transfer.

SOAP is a XML based messaging protocol and REST is not a protocol but an architectural style. REST does not enforces message format as XML or JSON etc.

Since SOAP messages are wrapped in a SOAP envelope it can be sent over to any transport mechanism e.g. TCP, FTP, SMTP or any other protocol. On the other hand, RESTful Web services are heavily dependent upon HTTP protocol.

SOAP uses services interfaces to expose the business logic.REST uses URI to expose business logic.

SOAP has a set of standard specifications e.g. specification for security (WS-Security) , specifications for messaging, transactions, etc. Unlike SOAP, REST does not has dedicated concepts for each of these. REST predominantly relies on HTTPS. SOAP is strongly typed, has strict specification for every part of implementation.  REST gives the concept and less restrictive about the implementation. Therefore REST based implementation is simple compared to SOAP and consumer understanding.

REST web service takes full advantage of the web caching mechanism because they are URL based. On the other hand, SOAP web services totally ignore web caching mechanism.

REST follows stateless model. SOAP has specifications for stateful implementation as well.

SOAP requires more bandwidth and resource than REST.

REST web services are much simpler, flexible and expressive than SOAP web services in Java.

When using REST over HTTP, it will utilize the features available in HTTP such as caching, security etc.

REST serves JSON that is faster to parse than XML.

JAX-WS is the java API for SOAP web services. JAX-RS is the java API for REST web services.

 

Leave a Reply

Your email address will not be published. Required fields are marked *