The SOA and ROA architectural design paradigms provide a way to build robust distributed architectures. In essence, ROA is a specific set of guidelines for a RESTful architecture. ROA is a structural design that provides support for internetworking of resources. A resource is an entity that can be identified using a URI. Servers, computers, computer devices, web pages, scripts, and so on, are all resources in the context of ROA. While SOA is verb oriented, ROA is noun oriented.
ROAs involve retrieval of particular resource instances. Requests in an ROA are stateless. The resource lifecycle management verbs include PUT
, DELETE
, GET
, and POST
. In an ROA, you have a service provider that maintains a collection of resources. This service provider exposes some basic operations, such as the following:
Here is a list of the core operations supported by RESTful services:
ROAs mainly thrive on a resource. A resource is a distributed component that is handled using a standard common interface. A resource is essentially defined using a noun. An employee's employment contract is an example of a resource—it describes the data that the resource represents. Note that a resource can be related or linked to other resources. ROA is based on the principle that any entity that can be assigned a uniform resource identifier can be called a resource.
A resource is identified using the following:
Each resource is identified by having a URI of its own. The URI is the name and address of the resource. URIs should be descriptive, as shown here:
http://www.packtpub.com/sales/2012/Q4
http://www.packtpub.com/sales/2012/Q3
Note that a resource can have one or more URIs. For example, the details of the sales figures for Q4 of 2012 can also be available at a different URI, as shown here:
http://www.packtpub.com/sales/2012/Q4
http://www.packtpub.com/sales/year/2012/Q4
In the preceding example, both the URIs point to the same resource.
Addressability is an interesting aspect of every ROA. We may say that an application is addressable if it exposes its data as resources. Now, resources in ROA are exposed using URIs. So, we may say that in order for an application to be addressable, it should expose its data through URIs.