An introduction to RESTful Web Services
What is REST?
REST is an acronym for one popular architectural style, Representational State Transfer. It is an architectural style for building distributed software systems like the WWW. It is modeled after the way data is represented, accessed and modified on the web. This is based on Chapter 5 of Roy Fielding's PhD dissertation.
In the REST architecture, data and functionality are considered resources, and these resources are accessed using URIs. The core principle of REST is - 'Everything is a resource'. For the same reason, it is quiet often referred to as "resource-oriented architecture".
RESTful Web Services
RESTful Web Services are web services which are built on the REST architecture. These services expose the resources through web URIs. The following HTTP methods are used to create, retrieve, update and delete (CRUD) resources:
- POST
- GET
- PUT
- DELETE
RESTful web services might be programmed in such a way that they serve data of various mime-types. For instance, they might take requests and respond with following types of data depending on the accept-type request header:
- Plain-Text (text/plain)
- HTML (text/html)
- JavaScript Object Notation (application/json)
- XML (application/xml)
RESTful Web Services vs SOAP Web Services
| RESTful | SOAP |
| ROA - Resource oriented architecture |
SOA - SOAP oriented architecture |
| Response is encapsulated in HTTP envelope. |
Response is encapsulated in SOAP envelope, which in turn is encapsulated in HTTP envelope. |
| WADL describes the web service. |
WSDL describes the web service. |
| Light weight, easy to develop. |
Heavy weight, complex. |
| Tied to HTTP protocol |
Built on RPC |