SOAP Vs REST

SOAP Vs REST

Below are the some main difference between SOAP Vs REST.


SOAP stands for Simple Object Access Protocol REST stands for REpresentational State Transfer.
SOAP is a XML based messaging protocol REST is an architectural style. REST does not enforces message format as XML etc
SOAP is a simple XML-based protocol to let applications exchange information over HTTP. REST facilitates the transaction between web servers by allowing loose coupling between different services.
RESTful applications use HTTP requests to post data (create and/or update), read data (e.g., make queries), and delete data.
Easy to consume – sometimes Rigid, adheres to a contract, Development tools required for consuming web services Lightweight – not a lot of extra xml markup. Human Readable Results. Easy to build – no toolkits required
SOAP has specifications for stateful implementation as well. REST follows stateless model
SOAP-based web service is protocol specific REST is just the guideline.
SOAP uses interfaces and named operations to expose business logic. REST uses (generally) URI and methods like (GET, PUT, POST, DELETE) to expose resources.
SOAP has a set of standard specifications. WS-Security is the specification for security in the implementation. It is a detailed standard providing rules for security in application implementation. Like this we have separate specifications for messaging, transactions, etc. Unlike SOAP, REST does not has dedicated concepts for each of these. REST predominantly relies on HTTPS.
SOAP invokes services by calling RPC method. REST just simply calls services via URL path
SOAP is most appropriately used for large enterprise applications rather than smaller, more mobile applications REST is most appropriately used for smaller, more mobile applications, rather than large, enterprise applications
For using a SOAP based web service, client needs to create the proxy for the web service (stub) and then invoke the method on the proxy while REST client can just use the URI for a web service, and invoke the service by using HTTP GET on the URI.
Focused on accessing named operations, each of which typically implements some logic.
Different applications expose different interfaces
Focused on accessing named resources, each of which typically represents some data.
Every application exposes its resources through
the same interface
Scalability:
SOAP – No automated caching possible
HTTP POST used for tunneling all requests
Scalability:
Leverages Internet intermediary caching (HTTP Proxies)
Uniform interface, Idempotent methods
Security:
WS-Security, WS-SecureConversation
OASIS Standards, Interoperable
Security:
Only possible at application level
No Standards, Limited interoperability
Google seams to be consistent in implementing their web services to use SOAP, with the exception of Blogger, which uses XML-RPC. All of Yahoo’s web services use REST, including Flickr and both eBay & Amazon have web services for both REST and SOAP
if the project requires a high level of security and a large amount of data exchange, then SOAP is the appropriate choice If there are resource constraints and if there is a need that the code should be written faster, then REST is better.