REST and SOA – the compatible duo
by Goutam Mukherjee
REST has made huge inroads into the Services space in last few years. It has become a very popular style to define how the Service Interfaces are designed and how the Services are accessed. Since SOA is also all about "Services", it is obvious that there will be an inclination to draw some correlation between REST and SOA and rightfully so. Sometimes that does open doors for some confusion and you start asking questions like “Am I not implementing SOA if I adopt REST style?” or “Does REST have inherent support for SOA?” or “Is REST the next level to attain after SOA” or even “Has SOA given way for REST?” and so on. So it does make sense to try to understand these two concepts and try to correlate the two.
Let's now have a quick look at what are the basic SOA principles. SOA comprises of a collection of Services and those Services conform to some basic principles. As Thomas Erl has outlined in http://www.soaprinciples.com, the basic SOA principles are –
- Standardized Service Contracts
- Service Loose Coupling
- Service Abstraction
- Service Reusability
- Service Autonomy
- Service Statelessness
- Service Discoverability
- Service Composability
REST – Representational State Transfer – is an architectural style. The basis of the REST style is that you define the resources for your application and then use the standard HTTP methods to perform the state changes to those resources. Some key features of the REST style are –
- Unique identifiability of the resources through URIs
- Uniform interface to access the resources
- Navigability of the resource representations through hypermedia
- Statelessness
Now if we see at the key features of the REST style, each one of them does map to one or more SOA principles. For example, “uniform interface to access the resources” maps to standardized Service Contracts, Service Loose Coupling and Service Abstraction. Except for one SOA principle – Service Discoverability – that is not directly covered by the REST features, all other basic SOA principles are realized by one or more REST features.
So now let us try to correlate the two. As defined in Wikipedia, REST is "a style of software architecture for distributed hypermedia systems such as the World Wide Web". Also we have already seen that the features of REST are very much compatible with the basic SOA principles. So we can draw the correlation that REST is an architectural style that inherently helps to attain some of the basic SOA principles and this is even more a perfect match when you are designing SOA under the constraints of "distributed hypermedia systems”.




Comments
Does REST need to draw correlation with SOA principles?
Posted by: Shafeer | October 9, 2009 2:08 PM
I think so. There are some scenarios in the industry where you need to build services that are "SOA based" and then you get another requirement for the same set of services where it says that the services should be "RESTful". Then the question invariably comes that how do they correlate. So this blog was an effort to draw that relationship.
Posted by: Goutam Mukherjee | November 4, 2009 10:36 AM