SOAP vs REST web services

1. Introduction

REST and SOAP are 2 popular approaches to create web services. Both enable you to define how to build application programming interfaces (APIs), which allow data to be communicated between web applications.

Representational state transfer (REST) is a set of architectural principles. Simple object access protocol (SOAP) is a protocol maintained by the World Wide Web Consortium (W3C).

2. What is SOAP?

SOAP stands for Simple Object Access Protocol, a messaging protocol specification for exchanging structured information using XML while creating web services, and relies on application layer protocols, usually HTTP.

3. What is REST?

Representational state transfer (REST) is a software architectural style which can be used to create APIs. RESTful web APIs are typically based on HTTP methods to access resources via URLs and the use of JSON or XML to transmit data.

4. Difference between SOAP and REST

SOAP stands for Simple Object Access Protocol.REST stands for REpresentational State Transfer.
SOAP is a protocol.REST is an architectural style.
SOAP can only work with XML format. All data is sent as XML in SOAP.REST can send data as text, HTML, XML, JSON, etc.
SOAP contains a WSDL file while contains all the information about the web service like the location of service.REST does not contain WSDL file. 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 more bandwidth since SOAP messages in XML contain lot of information.
A sample WSDL can be viewed at This is a sample WSDL provided at https://www.w3.org/2001/04/wsws-proceedings/uche/wsdl.html.
REST does not need much bandwidth. JSON is the preferred format for requests. Following is an example of JSON request:
SOAP used XML which has a complex format in comparison to JSON used in REST.REST can use JSON which is easy to understand.
SOAP uses service interfaces to expose its functionality to client applications.In REST, resources are exposed as Uniform Service Locator endpoints over HTTP. For example, to access Employee with id as 1, the endpoint could be https://learnitweb.com/Employee/1