Friday 20 January 2017

Difference between REST web services and SOAP web services


SOAP
REST

REST is more simple and easy to use as it is based on use of nouns and verbs (better readability)

SOAP uses XML
REST uses HTTP protocol for producing or consuming web services

The SOAP WS is transport protocol neutral. Supports multiple protocols like HTTP(S), Messaging, TCP, UDP SMTP, etc
REST is transport protocol specific. Supports only HTTP or HTTPS protocols.


REST is lightweight as compared to SOAP and preferred choice in mobile devices and PDA's.

REST does not need XML parsing, no message header (to and from), hence less bandwidth

SOAP only supports XML.

REST supports different format like text, JSON and XML
SOAP based reads cannot be cached.
REST based reads can be cached.

SOAP: can have user defined error
REST: requires HTTP error handling         
   
SOAP supports both SSL security and WS-security, which adds some enterprise security features like maintaining security right up to the point where it is needed, maintaining identities through intermediaries and not just point to point SSL only, securing different parts of the message with different security algorithms, etc.

The REST supports only point-to-point SSL security. The SSL encrypts the whole message, whether all of it is sensitive or not.

The SOAP has comprehensive support for both ACID based transaction management for short-lived transactions and compensation based transaction management for long-running transactions. It   also supports two-phase commit across distributed resources.

The REST supports transactions, but it is neither ACID compliant nor can provide two phase commit across distributed transactional resources as it is limited by its HTTP protocol.

The SOAP has success or retry logic built in and provides end-to-end reliability even through SOAP intermediaries
REST does not have a standard messaging system, and expects clients invoking the service to deal with communication failures by retrying

No comments:

Post a Comment