Problem statement: what are the difference between REST & SOAP?
- SOAP:
- SOAP stands for Simple Object Access Protocol
- SOAP can only works with XML format
- 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.
- JAX-WS is the java API for SOAP web services.
- SOAP does not support error handling
- 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>
- SOAP defines its own security.
- SOAP is not lightweight and it require XML parsing
- REST
- REST stands for REpresentational State Transfer
- REST can works with different format like XML, JSON, plain text, HTML, etc
- 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
- JAX-RS is the java API for RESTful web services.
- REST support built-in error handling
- REST requires less bandwidth and resource than SOAP. for example {"city":"Mumbai","state":"Maharastra"}
- RESTful web services inherits security measures from the underlying transpor
- REST is lightweight and does not require XML parsing.
- 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