Resource Oriented and Service Oriented Architecture

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:

  • Creation of new resources
  • Retrieval of resources
  • Modification of resources
  • Deletion of resources

Here is a list of the core operations supported by RESTful services:

  • GET: This is an operation that returns the state of the identified resource
  • POST: This is an operation that is used to update a particular resource
  • PUT: This operation is used to create a new resource
  • DELETE: This operation is used to delete or destroy a particular resource

Resource

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.

Note

Note that no two resources can be the same though they can point to the same data. A resource can have one or many URIs. For example, you can have the same sales data available at multiple URIs.

A resource is identified using the following:

  • Resource name: This is a unique name that identifies a resource
  • Resource representation: This provides metadata information about the current state of a resource
  • Resource link: This is a link to the same resource or other resources
  • Resource interface: This is a uniform interface that is used for assessing the resource and manipulating the state of the resource

Uniform resource identifier

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

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

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.

Statelessness

Statelessness is another important aspect of an ROA. This implies that each and every HTTP request is isolated, that is, it occurs in complete isolation.

Representations

Representation is defined as some data that depicts the current state of a resource. For example, when a web server sends data as a series of bytes, it is a representation of a resource.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset