Simple Object Access Protocol (SOAP) and Representational State Transfer (REST) are two answers to the same question: how to access Web services. The choice initially may seem easy, but at times it can be surprisingly difficult. Lets 1st understand what both are and how REST differs from SOAP –
REST describes a set of architectural principles by which data can be transmitted over a standardized interface (such as HTTP). REST does not contain an additional messaging layer and focuses on design rules for creating stateless services. A client can access the resource using the uniqueURI and a representation of the resource is returned. With each new resource representation, the client is said to transfer state.
REST, which typically runs over HTTP (Hypertext Transfer Protocol), has several architectural constraints:
- Decouples consumers from producers
- Able to leverage a cache
- Leverages a layered system
- Leverages a uniform interface
SOAP is an open-standard, XML-based messaging protocol for exchanging information among disparate operating systems (such as Windows and Linux) to communicate using Hypertext Transfer Protocol (HTTP) and its Extensible Markup Language (XML).
SOAP is an acronym for Simple Object Access Protocol. It is an XML-based messaging protocol for exchanging information among computers. SOAP is an application of the XML specification.
Below points briefly describes the nature of SOAP −
- SOAP is a communication protocol designed to communicate via Internet.
- SOAP can extend HTTP for XML messaging.
- SOAP provides data transport for Web services.
- SOAP can exchange complete documents or call a remote procedure.
- SOAP can be used for broadcasting a message.
- SOAP is platform- and language-independent.
- SOAP is the XML way of defining what information is sent and how.
- SOAP enables client applications to easily connect to remote services and invoke remote methods.
Now once the understanding of REST and SOAP is clear , lets compare and find out how they differ in characteristics and behaviors –