Service Oriented Vs. Resource Oriented
REST is often misconstrued as a mechanism to perform RPC, by means of sending XML, without SOAP, over HTTP. RPC revolves around the idea of invoking procedure on a remote server. This is conceptually different from REST, in which, components collaborate by sending representations of resources, to each other. Information about what has to be done with the representation does not have any bearing on the representation (data) sent along. In RPC typically, many operations are invoked at the same URI, where content of message is used to route message to appropriate operation. REST, on the other hand, has a unique URI for each resource. With REST everything is a resource; be it application’s data or its functionality.
REST is often compared to SOAP; SOAP is a protocol whereas REST is an architectural style. REST does not mandate or promote use of any specific protocol. Having said this, it is also important to mention that services can be created using design principals of REST, in which case they are referred as RESTful services.
At the fundamental level, the difference between the REST style and SOAP style Web services is resource versus activity. Services can be abstracted to activities on a system. In a traditional service oriented system, the activities are the key point with a single operation for each activity the service consumer might request to be performed. Resource Oriented Architecture encourages the service provider to maintain a collection of resources and exposes a collection of basic operations to perform such tasks:
- Retrieving the resources
- Modifying the resources
- Creating new resources
- Deleting resources
REST-style Web services are based on Resource oriented Architecture. You can identify and locate resources by URI, and the operations are HTTP specific. These operations would include HTTP-GET, HTTP-POST, HTTP-PUT, and HTTP-DELETE. In many ways they are similar to the operations on a database such as SQL SELECT, INSERT, UPDATE, DELETE and so forth.
SOAP-style Web services are generally service oriented. The WSDL document defines and describes the service-specific operations. These operations encapsulate an exchange of service-specific messages. Each operation would invoke the specific operation on the service provider at service consumer request that is enclosed in the SOAP message and the information is returned through a SOAP message.