REST vs SOAP

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
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
Doesn’t impose any constraint in data format, supports multiple data formats – JSON, XML, CSV etc.Supports XML message format only
REST resources are exposed by the service URI and HTTP Verbs- GET, PUT, POST and DELETESOAP 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.
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)
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 informationSOAP Web services uses SOAP headers with its requests that contain meta/additional information about the request
RESTful web services are easier and faster to createSOAP web service follow a contract and are preferred for implementing complex logic
Last difference, REST stands for Representational State TransferSOAP stands for Simple Object Access Protocol

Leave a Comment