What is difference between SOAP and REST API.

niveditakumari
Mega Sage

Hi, 

 

What is difference between SOAP and REST API. I have gone through many documents but didn't get it. 

Can anyone please tell me important difference between SOAP and REST API. 

 

Regards, 

Nivedita

 

 

1 ACCEPTED SOLUTION

Omkar Kumbhar
Mega Sage
Mega Sage

Hello @niveditakumari ,

SOAP


REST

SOAP stands for Simple Object Access ProtocolREST stands for Representational State Transfer
SOAP is a protocol. SOAP was designed with a specification. It includes a WSDL file which has the required information on what the web service does in addition to the location of the web service.REST is an Architectural style in which a web service can only be treated as a RESTful service if it follows the constraints of being

 

  1. Client Server
  2. Stateless
  3. Cacheable
  4. Layered System
  5. Uniform Interface
SOAP cannot make use of REST since SOAP is a protocol and REST is an architectural pattern.REST can make use of SOAP as the underlying protocol for web services, because in the end it is just an architectural pattern.
SOAP uses service interfaces to expose its functionality to client applications. In SOAP, the WSDL file provides the client with the necessary information which can be used to understand what services the web service can offer.REST use Uniform Service locators to access to the components on the hardware device. For example, if there is an object which represents the data of an employee hosted on a URL as http://demo.guru99 , the below are some of URI that can exist to access them.

 

http://demo.guru99.com/Employee

http://demo.guru99.com/Employee/1

SOAP requires more bandwidth for its usage. Since SOAP Messages contain a lot of information inside of it, the amount of data transfer using SOAP is generally a lot.

 

<?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.guru99WebService
 xmlns="http://tempuri.org/">
   <EmployeeID>int</EmployeeID>
   </Demo.guru99WebService>
 </soap:Body>
</SOAP-ENV:Envelope>
REST does not need much bandwidth when requests are sent to the server. REST messages mostly just consist of JSON messages. Below is an example of a JSON message passed to a web server. You can see that the size of the message is comparatively smaller to SOAP.

 

{"city":"Mumbai","state":"Maharastra"}
SOAP can only work with XML format. As seen from SOAP messages, all data passed is in XML format.REST permits different data format such as Plain text, HTML, XML, JSON, etc. But the most preferred format for transferring data is JSON.
If I was able to help you with your case, please click the Thumb Icon and mark as Correct.

View solution in original post

1 REPLY 1

Omkar Kumbhar
Mega Sage
Mega Sage

Hello @niveditakumari ,

SOAP


REST

SOAP stands for Simple Object Access ProtocolREST stands for Representational State Transfer
SOAP is a protocol. SOAP was designed with a specification. It includes a WSDL file which has the required information on what the web service does in addition to the location of the web service.REST is an Architectural style in which a web service can only be treated as a RESTful service if it follows the constraints of being

 

  1. Client Server
  2. Stateless
  3. Cacheable
  4. Layered System
  5. Uniform Interface
SOAP cannot make use of REST since SOAP is a protocol and REST is an architectural pattern.REST can make use of SOAP as the underlying protocol for web services, because in the end it is just an architectural pattern.
SOAP uses service interfaces to expose its functionality to client applications. In SOAP, the WSDL file provides the client with the necessary information which can be used to understand what services the web service can offer.REST use Uniform Service locators to access to the components on the hardware device. For example, if there is an object which represents the data of an employee hosted on a URL as http://demo.guru99 , the below are some of URI that can exist to access them.

 

http://demo.guru99.com/Employee

http://demo.guru99.com/Employee/1

SOAP requires more bandwidth for its usage. Since SOAP Messages contain a lot of information inside of it, the amount of data transfer using SOAP is generally a lot.

 

<?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.guru99WebService
 xmlns="http://tempuri.org/">
   <EmployeeID>int</EmployeeID>
   </Demo.guru99WebService>
 </soap:Body>
</SOAP-ENV:Envelope>
REST does not need much bandwidth when requests are sent to the server. REST messages mostly just consist of JSON messages. Below is an example of a JSON message passed to a web server. You can see that the size of the message is comparatively smaller to SOAP.

 

{"city":"Mumbai","state":"Maharastra"}
SOAP can only work with XML format. As seen from SOAP messages, all data passed is in XML format.REST permits different data format such as Plain text, HTML, XML, JSON, etc. But the most preferred format for transferring data is JSON.
If I was able to help you with your case, please click the Thumb Icon and mark as Correct.