SOA - Introduction: Srikanth Gunturu
SOA - Introduction: Srikanth Gunturu
Srikanth Gunturu
Lets begin with a simple question…
What is a service ?
Service Oriented Architecture (SOA)
Service Oriented Architecture (SOA)
A Service Oriented Architecture (SOA) is a form of distributed systems
architecture that is typically characterized by the following properties
Logical view
Message Orientation
Description Orientation
Granularity
Network Orientation
Platform Neutrality
Multiple methodologies are used to implement SOA
Remote Procedure Call (RPC)
Arbitrary Web services (SOAP/XML)
RESTful Web services
Apache Thrift
Messaging protocols (RabbitMQ, JMS etc.)
OPC Unified Architecture (OPCUA)
Web service – defined…
“A web service is a software system designed to support interoperable
machine-to-machine interaction over a network.” – W3C glossary
“It [Web Service] has an interface described in a machine-processable
format (specifically WSDL). Other systems interact with the web service in a
manner prescribed by its description using SOAP-messages, typically
conveyed using HTTP with an XML serialization in conjunction with other
web-related standards.” – W3C basic definition, 2002
Web service - redefined !
“An even more constrained architectural style for reliable Web applications known
as Representation State Transfer (REST) has been proposed by Roy Fielding and has
inspired both the W3C Technical Architecture Group's architecture document [Web
Arch] and many who see it as a model for how to build Web services [Fielding]. The
REST Web is the subset of the WWW (based on HTTP) in which agents
provide uniform interface semantics -- essentially create, retrieve, update and delete --
rather than arbitrary or application-specific interfaces, and manipulate resources only
by the exchange of representations. Furthermore, the REST interactions are
"stateless" in the sense that the meaning of a message does not depend on the state
of the conversation.
We can identify two major classes of Web services:
REST-compliant Web services, in which the primary purpose of the service is to
manipulate XML representations of Web resources using a uniform set of
"stateless" operations; and
arbitrary Web services, in which the service may expose an arbitrary set of
operations.”
-W3C refined definition, 2004
Arbitrary WS vs RESTful WS
Arbitrary Web services (SOAP WS) RESTful Web services
Exposes services as individual operations, each to Representational State Transfer is an architectural
achieve a specific business objective. style for defining interoperability in terms of
resources or concepts
Introduced in W3C draft for web services in 2002 Introduced in W3C extended revision in 2004
Uses Simple Object Oriented Protocol (SOAP), a REST supports SOAP/XML/JSON or any other
variant of XML for data transfer data protocol supported by HTTP
Service contract definition is specified via Web Service contract is defined via resource or concept
service description language (WSDL) endpoints and HTTP methods (POST/ GET/ PUT/
DELETE) defined on them
JAX-WS is the binding protocol used JAX-RS is binding protocol used
Imposes a rigid structure for service definition and Does not impose any specific structure – any
request/response format supported by HTTP is accessible
Requires more footprint and bandwidth, resulting in Light-weight formats (like JSON) require less
performance issues at large scale footprint there by improving performance
Defines its own security, as defined by SOAP-WS Inherits security measures from the underlying
security transport protocol (TCP, UDP etc.)
REST – Architectural Constraints
Client-server model - “Servers and clients may also be replaced
and developed independently, as long as the interface between
them is not altered”
Statelessness - “No client context shall be stored on the server
between requests. Client is responsible for managing the state of
application.”
Cacheability – “Well-managed caching partially or completely
eliminates some client–server interactions, further improving
scalability and performance”
Layered system – “Client need not be aware of underlying layers
managed by the service provider”
REST – Architectural Constraints
(contd.)
Code-on-demand (optional) – “..when you need to, you are free to return
executable code to support a part of your application..”
Uniform interface – “Once a developer become familiar with one of your
API, he should be able to follow similar approach for other APIs”
Resource identification in requests
Resource manipulation through representations
Self-descriptive messages
Hypermedia As The Engine Of Application State (HATEOAS)
Statelessness
You stick to the finite set of operations of the application protocol you are
distributing your services upon. Which means that you don’t have action
“Parameter” in the URI and use the methods of HTTP for your web services.
HTTP has a small fixed set of operational methods.
Create - POST
Retrieve - GET
Update - PUT
Delete - DELETE
POST
Requests that the server store the message body sent with the request
under the location provided in the HTTP message
Usually modelled as Insert/Update
Idempotent
When using it, client knows the identity of the resource it is creating or
updating.
Sending the same PUT message more than once has no effect on the
underlying service
Example: Saving a word document n no of times doesn’t change it every
time
Returns 200 for just update, 201 if new data is created (not recommended)
DELETE
Aggregation is not the full concept of HATEOAS, rather it’s the Engine
It’s different because with each request returned from server it tells you
what new interactions you can do next, as well as where to go to transition
the state of your applications.
Example:
<products>
<link rel=“next” href=http://abc.com/store/products?startIndex=5/>
<products>
<link rel=“previous” href=http://abc.com/store/products?startIndex=0/>
<link rel=“next” href=http://abc.com/store/products?startIndex=10/>