Saturday, June 2, 2018

What are the difference between REST & SOAP?

Problem statement: what are the difference between REST & SOAP?
  • SOAP:
  1. SOAP stands for Simple Object Access Protocol
  2. SOAP can only works with XML format
  3. SOAP uses service interfaces to expose business logic. WSDL(Web service description language) file provides information that can be used to understand what services the web service can offer.
  4. JAX-WS is the java API for SOAP web services.
  5. SOAP does not support error handling
  6. SOAP requires more bandwidth and resource than REST. example
<?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>
 <Demo.ishaanoneWebService xmlns="http://tempuri.org/">
   <EmployeeID>int</EmployeeID>
   </Demo.ishaanoneWebService>
 </soap:Body>
</SOAP-ENV:Envelope>
  1. SOAP defines its own security.
  2. SOAP is not lightweight and it require XML parsing
  • REST
  1. REST stands for REpresentational State Transfer
  2. REST can works with different format like XML, JSON, plain text, HTML, etc
  3. REST uses URI to expose business logic. For example, if there is an object which represents the data of an employee hosted on a URL can be accessed as http://demo.ishaanone.com/Employee
  4. JAX-RS is the java API for RESTful web services.
  5. REST support built-in error handling
  6. REST requires less bandwidth and resource than SOAP. for example {"city":"Mumbai","state":"Maharastra"}
  7. RESTful web services inherits security measures from the underlying transpor
  8. REST is lightweight and does not require XML parsing.
  9. REST is useful for restricted devices, such as mobile, for which the overhead of additional parameters are less (e.g., headers)

No comments:

Post a Comment

How to run standalone mock server on local laptop

 Please download the standalone wiremock server from Direct download section at the bottom of the page.  Download and installation Feel fre...