Difference Between REST and SOAP Web Service

In this tutorial we will see the difference between a SOAP and REST Web service. Please do read the tutorial Introduction to Web Services before this tutorial, to get a better understanding of web services.

#REST Web ServiceSOAP Web Service
1. REST is an architectural style, any web service following REST architecture is called RESTFul Web Service. SOAP is a protocol, a set of rules which must be followed while creating a web service
2. Doesn't impose any constraint in data format, supports multiple data formats - JSON, XML, CSV etc. Supports XML message format only
3. REST resources are exposed by the service URI and HTTP Verbs- GET, PUT, POST and DELETE SOAP exposes its named methods to be consumed by a client e.g. an open SOAP web service "WeatherWS" exposes its various operations as methods- GetWeatherInformationResponse, GetCityForecastByZIP, WeatherDescription etc.
4. REST is considered light weight and faster(no XML parsing is required) Slower than REST because of the use of verbose XML format but considered more secure (uses WS-security, a component of Web Service Specification for improving web service security)
5. REST APIs consume less bandwidth as the request doesn't require SOAP headers in every message. REST make use of HTTP headers for any meta information SOAP Web services uses SOAP headers with its requests that contain meta/additional information about the request
6. RESTful web services are easier and faster to create SOAP web service follow a contract and are preferred for implementing complex logic
7. Last difference, REST stands for Representational State Transfer SOAP stands for Simple Object Access Protocol