Simple Object Access Protocol is a lightweight, XML-based protocol used to exchange information over the Internet between programs running in same or different operating system. SOAP messages can be transported using a variety of protocols, including HTTP, SMTP or MIME. All SOAP messages use the same format making it compatible with a variety of operating systems and protocols.
Why to use HTTP protocol for SOAP messages?
Traditionally, HTTP protocol is used to sent web pages over the internet. Since firewalls usually don’t block port 80 (HTTP) traffic, so most SOAP messages can pass through without any problems.
Representational State Transfer (REST)
The REST is a stateless architecture based on web-standards and generally runs over HTTP. It was first described by Roy Fielding in 2000. The architecture treats every entity as a resource, which can be accessed through a common interface based on the HTTP standard methods.
The REST architecture typically has a REST client and a server. The server usually provides access to the resources and a client accesses and modify the resources. Resources are identified using the global ID’s (which are typically Universal Resource Indicators (URIs)). The architecture emphasises on having a limited number of operations between the client and a server to improve the efficiency of a system.
Difference between SOAP and REST web services
- SOAP is an XML-based messaging protocol whereas REST is an architectural style.
- SOAP is designed to handle distributed computing, whereas REST assumes point to point communication where the intermediary does not play a significant role.
- REST does not require anything but HTTP. SOAP requires a complete set of tools and middleware support.
- There is a built-in error handler in REST. No such handler present in SOAP.