Ten or 15 years ago, when people talked about Web Services, you would immediately understand they were referring to SOAP. But these days, if someone says they have a Web Service interface, you need to follow up with the question: “What kind of Web Service – SOAP or REST? ” In fact, REST is fast becoming the more visible application interface on the Internet. This blog provides a quick overview of what REST is, and how it compares to SOAP.
Firstly, like SOAP, REST is a Web Service, which by definition provides an Application-to-Application interface. So functionally, REST is similar to SOAP in that it enables a Client application to invoke an operation/method in a Server application . Furthermore, REST uses HTTP and HTTPS as the communication protocol, just as SOAP does. Their differences lie in what is underneath the cover.
SOAP Web Service
One of the key underpinning of SOAP Web Service is the usage of XML in its:
- Messaging protocol (SOAP)
- Description of services (WSDL)
- Actual data representation (payload)
REST Web Service
Proponents of REST view XML as the major reason to move away from SOAP Web Service because of its verbosity: XML encoded data could increase the size of the message enormously.
So instead, REST Web Service embodies the following:
- No standardized messaging protocol like SOAP
- No standardized description of services like WSDL
REST embraces the adoption of utilizing URL and HTTP protocol methods (verbs) to convey methods/operation. So instead of using WSDL like in SOAP to convey exactly what the operation is, the standard HTTP verb is used “by convention” to convey what is needed.
The perceived benefits of this approach are:
- It eliminates the need of an XML Parser
- JSON messages are smaller than XML messages
- It eliminates the client application to understand how to handle SOAP protocol or interrupt the web service description
These are especially important factors in “lightweight” clients like mobile applications. This can be demonstrated by a simple example below, comparing a REST request with a SOAP request.
More to come
Does this mean that REST is always better than SOAP? Is REST limited to only mobile applications or JSON data? What is the significance of using REST with NonStop applications?
We will explore these and other questions in our next blogs.
Do you find this tutorial blog helpful? Let us know what you think, and how we can make it even better. Don’t forget, you can subscribe to our blogs (top right-hand corner of the home page) to get automatic email notification when a new blog is available.