This article is to compare REST vs SOAP. There is huge difference between REST and SOAP. Comparing SOAP and REST is not just right as they are different things. It is like comparing orangutan and octopus, I have high regard for both of them. But still, as it is a popular topic lets have a discussion on SOAP vs REST.
Roy Fielding was a member of the team that wrote the specification for HTTP and co-founder of Apache HTTP server project. He introduced the word REST and the concept in his doctoral thesis in 2000. REST disruptively took over as an architectural style for web services implementation.
- 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.
- SOAP has a standard specification but there is none for REST.
- Whole of the web works based on REST style architecture. Consider a shared resource repository and consumers access the resources.
- Even SOAP based web services can be implemented in RESTful style. REST is a concept that does not tie with any protocols.
- SOAP is distributed computing style and REST is web style (web is also a distributed computing model).
- REST messages should be self-contained and should help consumer in controlling the interaction between provider and consumer(example, links in message to decide the next course of action). But SOAP doesn’t has any such requirements.
- REST does not enforces message format as XML or JSON or etc. But SOAP is XML based message protocol.
- REST follows stateless model. SOAP has specifications for stateful implementation as well.
- SOAP is strongly typed, has strict specification for every part of implementation. But REST gives the concept and less restrictive about the implementation.
- Therefore REST based implementation is simple compared to SOAP and consumer understanding.
- 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.
- Above all both SOAP and REST depends on design and implementation of the application.
Reference :: javapapers