|
Answer» Before differentiating between SOAP and REST, let us first look at what these are: - SOAP: A SOAP API is an XML DOCUMENT receiver that is also EXPECTED to react with an XML document. The XML document provided should include all parameters that the receiver must be able to respond to. Due to their difficulty in integrating across enterprises, SOAP APIs have recently lost favour.
- REST: REST is an architectural methodology for scalable web applications that stands for Representational State Transfer. A "REST-ful" web service is one that places less emphasis on rigid formatting and instead uses JSON (JavaScript Object Notation) formatted data in MESSAGE bodies rather than XML, while there is still a lot of XML in a RESTful web service.
The key differences between SOAP and REST are as follows: | SOAP | REST |
|---|
| SOAP (Simple Object Access Protocol) cannot make use of REST because of the fact that SOAP is just a protocol while REST is an architectural pattern. | It is possible for REST(Representational State Transfer) to make use of SOAP as an underlying protocol USED for web services since REST is an architectural pattern. | | SOAP stands for Simple Object Access Protocol. SOAP was created with a set of guidelines in mind. It includes a WSDL file that contains the needed information on what the web service does as well as the web service's location. | REST is an architectural approach in which a web service can only be considered RESTful if it complies with the following constraints: Client-Server, Stateless, Cacheable, Layered System and Uniform Interface. | | The only XML format is supported with SOAP since it can work only using XML data. | REST can support various types of data formats, for instance, HTML, Plain text, XML, JSON, etc. with the most preferable format being JSON (JavaScript Object Notation). | | SOAP exposes its functionality to client applications through service interfaces. The WSDL file in SOAP supplies the client with the essential information to determine what services the web service can provide. | To access the components on the HARDWARE device, REST uses Uniform Service locators. For example, if an object representing an employee's data is hosted at http://docs.google.com, the following are examples of the URIs that can be used to retrieve it. | | <?xml version="1.0"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2001/12/soap-envelope" SOAP-ENV:encodingStyle=" http://www.w3.org/2001/12/soap-encoding"><soap:Body><Docs.googleWebServicexmlns="http://tempuri.org/"> <DocumentId>int</DocumentID> </Docs.googleWebService></soap:Body></SOAP-ENV:Envelope> | {"city":"Kolkata","state":"West Bengal"} |
|