Service-Oriented
Architecture
Jorge Dias Jr.
RiSE (www.rise.com.br) December 2007Agenda
Evolution
SOA Introduction
Web Services
SOA and Quality Attributes
SOA Methodologies
SOA and BPM
BPMN (Business Process Modeling Notation)
Past, Present and Future of SOA
SOA
What is this?
A set of technologies?
A methodology?
An architectural pattern?
What else?
“By 2008, SOA will provide the basis for 80
percent of development projects” [Gartner]
“The problem is that you can’t just buy SOA;
you have to understand it and live it. SOA
is a paradigm. SOA is a way of thinking.
SOA is a value system for architecture and
Evolution
Physical Evolution
Logical Evolution (Paradigm Evolution)
Business Computing Evolution
Evolution
Physical Evolution
Client BusinessLogic Data Client BusinessLogic Data
Protocol Client Business Logic Data Prot ocol Business Logic Protoc ol BusinessLogic Protocol Protocol Data Protocol Monolithic Client/server N-tier
Evolution
Logical Evolution (Paradigm Evolution)
We have progressed from modules, to
objects, to components, and now to
services
1970s 1980s 1990s Early 2000s TODAY Reuse through function-oriented programming (sub-routine and function reuse Reuse through object-oriented programming (class reuse) Reuse through distributed object technologies and component based architectures (CORBA/DCOM/ DCE and component reuse
Reuse through early service orientation (reuse of web services) Service-Oriented Architectures (SOA) ▼ ▼ ▼ ▼ ▼
Evolution
Logical Evolution (Paradigm Evolution)
Object Object Object Component Object Object Object Component Service Object Object Object Component Object Object Object Component Service
Evolution
Service-Oriented Architecture
Evolution of object-orientationandcomponent-basedparadigm [Szyperski, 2002][McCoy et al., 2003]
Inter-enterprise Inter-application Intra-application Intra-application Communication scope Runtime Compile-time Compile-time Compile-time Dependencies Very Loose Loose Tight Tight Coupling High Medium Low Low Reusability Published Public Private/public Defined Contract Coarse Medium Fine Very fine Granularity Service-based development Component-based development Object-oriented development Structured development [McGovern, 2003]
Evolution
Business Computing Evolution
Dep A Application A Dep B Application B Dep C Application C Dep D Application D
Evolution
Business Computing Evolution
Company DBMS Application A Application B Application C Application D Dep A Dep B Dep C Dep D
Evolution
Business Computing Evolution
Applications Services
SOA Introduction
Service-Oriented Architecture
SOA has specific characteristics that turns
its a
new paradigm
SOA is the ideal solution for very special
circumstances:
heterogeneous
distributed
systems with
different owners
“
Find, bind and execute
” approach
Service-Oriented Architecture
Specific kind of software architecture
Software Architecture
Service-Oriented Architecture
Web Services Jini CORBA
implements
Service-Oriented Architecture
Definition
Several definitions
Many of definitions come from
vendors
and
are linked to the products they have to sell
[Jones, 2006]
Service-Oriented Architecture
Definition
SOA is a
software architecture
that is based
on the key concepts of an application
front-end, service, service repository, and service
bus. A service consists of a
contract
, one or
more
interfaces
, and an
implementation
[Krafzig et al., 2004].
Service-Oriented Architecture
Definition
A paradigm for organizing and utilizing
distributed capabilities
that may be under the
control of different
ownership domains
. It
provides a uniform means to offer, discover,
interact with and use capabilities to produce
desired effects consistent with measurable
preconditions and expectations [OASIS, 2006]
Service-Oriented Architecture
SOA Benefits
Better reuse
Build new client functionality on top of existing Business Services
Interoperability
Contract-based interfaces
Well defined interfaces
Make changes without affecting clients
Easier to maintain
Increased Organizational Agility
Better flexibility
Service-Oriented Architecture
SOA Roles
Service Consumer Service Provider Contract Service Registry B in d a n d e x e c u te Find Regis terService-Oriented Architecture
Common misperceptions about SOA
“An application that uses Web services is service-oriented.”
“SOA is just a marketing term used to re-brand Web services.”
“If you understand Web services you won't have a problem building SOA.”
“Once you go SOA, everything becomes interoperable.”
“Only Web services can be used to implement SOA.”
Service-Oriented Architecture
Service-orientation principles
[Erl, 2005]Services are
reusable
Services share a
formal contract
Services are
loosely coupled
Services abstract
underlying logic
Services are
composable
Services are
autonomous
Services are
stateless
Services are
discoverable
Service-Oriented Architecture
SOA Ingredients
Infrastructure
Enterprise Service Bus (ESB)
Architecture
Types of services, amount of loose coupling, data model, service interfaces, policies, rules and patterns
Processes
Business Process Modeling
Service lifecycle Governance
Service
Services represent
business
functionality
A well-defined
interface
Service
Kinds of service
Task-centric Services
Entity Services
Application Services
Infrastructure Services
Security, etc.Enterprise Service Bus
Works as a
middleware
Solves distributed system problems
Supports at least one form of
communication
publish/subscribe, request/response,
one-way, etc.
Supports
multiple transport
protocols
HTTP, JMS,…
Consumer
does not invoke directly
the
provider interface
Enterprise Service Bus
Web Services
"
A Web service is a software application
identified by a URI
, whose interface and
bindings are capable of being
identified
,
described
and
discovered
by XML artifacts and
supports direct interactions with other software
applications using
XML based messages
via
Internet-based protocols
."
[World Wide Web Consortium]
Web Services
Characteristics
There is not revolucionary neither exceptional
Technology simple!!
Set of
standarlized
technologies
Data format
Communication
Descriptions
based on XML
Middleware independent of platform and programming language
Easy communication through firewalls
Web Services
Web Services
Use Scenarios
Development of distributed applications
based on Web
Development of process-oriented
applications
Systems integration
Different operational system
Different programming language
Web Services
Web Services Architecture
Architecture Based on Roles:
-
Service provider: Web service supplier, who
implements and dispose the services.
-
Service requestor: Web Service consumer,
which uses a network connection and sends a
XML Request.
-
Service registry: Centralized services
repository, which the providers publish the
services.
Web Services Architecture
Architecture Based on Roles:
Service Requestor Service Registry Service Provider
Bind the service
Find the serv ice Pu blish the serv ice 1 2 3
Web Services Architecture
Architecture based on protocol stack
- Transport service: HTTP, SMTP, FTP, JMS.
- XML messaging: Layer responsible for coding the
messages on common XML format. Ex: XML-RPC e SOAP.
- Service description: Responsible for describing the
public interfaces of Web service. Ex: WSDL.
- Service discovery: Supplies facility for search and
Web Services Architecture
Architecture based on protocol stack
Discovery (UDDI) Description (WSDL) XML Messaging (XML-RPC, SOAP, XML) Transport (HTTP, SMTP, FTP, BEEP)
Web Services
SOAP
SOAP
Communication protocol among Web services
(W3C standard)
Defines the messages format changed among
Web services
Based on XML-RPC, with several evolutions
Independent of platform and programming
language
The communication can be realized by several
protocols, such as HTTP, SMTP, FTP, JMS, and
so on
SOAP
SOAP Format
SOAP Message Envelope (mandatory) Header (optional) Body (mandatory) Fault (optional)SOAP
SOAP Request
SOAP
SOAP Response
SOAP
Envelope
- SOAP-ENV:Envelope
- Version controled by namespace.
Version 1.1 <SOAP-ENV:Envelope xmlns:SOAP-ENV=http://schemas.xmlsoap.org/soap/envelope/> Version 1.2 <SOAP-ENV:Envelope xmlns:SOAP-ENV=http://www.w3.org/2001/09/soap-envelope>SOAP
Header
SOAP-ENV:Header
Generally it is processed by server side
The header format is not defined by specification to able flexibility for applications
It can be implemented authentication, transaction control, logging, etc.
Two attributes within header can be used:
SOAP-ENV:mustUnderstand when has value “1” obliges to the other side to handle the header, otherwise an error is thrown.
SOAP-ENV:actor is used to chain other Web services to end the processing.
SOAP
Header
<SOAP-ENV:Header>
<myNS:authentication
xmlns:myNS=http://www.stevepotts.com/auth
SOAP-ENV:mustUnderstand=“1”>
<login> admin </login>
<password> 123456 </password>
</myNS:authentication>
</SOAP-ENV:Header>
SOAP
Body
- SOAP-ENV:Body
- In this element where the payload of
SOAP message is put.
- It can be a method invocation, a XML
document or only a request with any
information.
SOAP
Fault
- SOAP-ENV:fault
- It indicates that a problem occurred in the
attempt of the processing of the request
sent to the Web service.
SOAP
Fault
Description Element name
This element should contain the maximum one of possible information about the state of the server in the moment of the fault.
detail
This optional element informs that service generated the fault.
faultActor
This element is a legible version for the man of the faultcode.
faultString
This element is required by the specification. It should have some code indicating what is the problem. faultcode
SOAP
Fault
Error generated when an element in the head cannot be processed and that element is marked as mandatory
SOAP-ENV:mustUnderstand
It occurs when versions of the processors SOAP of the client and of the server are different.
SOAP-ENV:versionMismatch
It indicates that some error happened with the message of the client.
SOAP-ENV:Client
An error occurred in the server upon treating the request of the client.
SOAP-ENV:Server
Description Faultcode type
SOAP
Datatypes
<nMat xsi:type=“xsd:string”> 10211013 </nMat>
Datatypes permitted:
Scalar types: int, double, string,... Structure types: array, structures.
SOAP
SOAP
SOAP via HTTP: Response
Web Services
WSDL
(Web Services Description Language)
WSDL
Represents the contract between the service
provider and the service consumer
Describes the services through of XML
specification
It is equivalent to the specification of IDL
interface of CORBA or DCOM
Describes:
Interface information
Datatype information for request and response messages
Transport protocol to be used
Information for the location of specific service
WSDL
WSDL Specification
Abstract part
types
message
portType
Concrete part
binding
service
WSDL
<types>: What datatypes will be transmitted
<message>: Which messages will be transmitted
<portType>: Which operations will be supported
<binding>: How the messages will be transmitted
<service>: Where the services will be localized
<definitions>: Root element of WSDL
WSDL
definitions
message
WSDL
portType
Four types of operations are permitted:
One-way Request-response Solicit-response Notification
WSDL
portType
WSDL
binding
service
Web Services
UDDI
(Universal Description, Discovery and Integration)
UDDI
Technical specification to describe, find and integrate Web services
Developed by Ariba, IBM and Microsoft in Set/2000
It is the registry provider of Web services
It stores the specifications WSDL of the service providers
It permits that clients find the service providers that they need and discovery how to request these services
It makes the role of RMI registry and name services of CORBA trading
At this moment UDDI is in version 3.0
UDDI
Characteristics
Registered Interfaces are described in WSDL
Records are stored in XML
It receives requests of registry and discovery
using the SOAP protocol
Companies can have their own private UDDI
servers for registering of internal services
It differs of a repository by do not possess the
UDDI
Service Searches
White pages: Provides the address to
contact the service provider.
Yellow pages: Classifies the providers in
categories according to their business
area.
Green pages: Provides technical
informations about the services.
UDDI
UDDI architecture:
UDDI Data model: XML schema to
describe the business of Web services.
UDDI API: API based on SOAP to publish
and search UDDI data.
UDDI cloud services: sites that provides
implementations of UDDI specifications.
Ex: IBM e Microsoft.
UDDI
The record has 4 information:
Business Entity
Unique identifier, Business name, Information for contact,
Business description,
List of categories that describes and classifies the business
A URL for more information about the business
UDDI
Business Service
Service description
List of category that describes the service
URL for more information about the service
Specification pointers
Associated with each business service entry is a
list of binding templates that point to specifications and other technical information about the service.
For example, a binding template might point to a
URL that supplies information on how to invoke the service.
UDDI
Service types
A technical model (tModel) defines a service type Multiple business can offer the same service type
defined by tModel
A tModel contains information contained in service,
such as
tModel name,
Organization name that creates the tModel,
Categories that defines the service type,
Pointers for specifications of service type, including
interface definition, message format, security, etc.
UDDI
UDDI has 5 structures
publisherAssertion
Describes the relationship between two partnerships
businessEntity
Contains information about the provider
businessService
Describes the different kind of services provided by a
provider
bindingTemplate
Contains technical informatio about the services tModel
Categorizes the services
UDDI
UDDI
UDDI
UDDI
Publishing
API
UDDI
Implementações
Java
- UDDI4J
- jUDDI
Microsoft COM
- UDDI SDK
Pearl
- SOAP::Lite
Web Services
Example
Example
Framework
Axis (Apache) – runs over Tomcat
Provider language
Java
Client language
Java
Service Provider
public class Calculator {public int somar(int numA, int numB) {
return numA+numB; }
public int subtrair(int numA, int numB) { return numA-numB; } }
Service Provider
Deploy
Automatically over JWS
Rename .java to .jwsManually over WSDD
Create a description file .wsdd Deploy with ‘deploy’ command
Service Client
Automatically
Generate the stubs with WSDL
wsdl2Java
Manually
Service Client – Automatically
(Java)
Service Client (PHP)
<?php
require_once('nusoap.php');
$param = array('numA'=>'2', 'numB'=>'3');
$serverpath ='http://services.xmethods.net:80/soap/servlet/rpcrouter'; $client = new soapclient($serverpath);
$soma = $client->call('somar',$param); if (isset($fault)) {
print "Error: ". $fault; }
else {
print "Resultado: ". $soma; } // kill object unset($client); ?>
Frameworks
AXIS (Apache)
GLUE
JWSDP (Sun)
Microsoft Web Services
XFire
J2ME
kSOAP
kXML
WS Specifications
Web Services Interoperability Organization
(WS-I) was chartered in 2002
Develops profiles
Suggests best practices
Provides testing tools
Examples
WS-Security
WS-Policy
WS-Reliability
WS-Security
Specified by Microsoft, IBM and VeriSign
in 2002 and adopted by OASIS
Defines an extension for Header of SOAP
Aims to resolve the SSL problems related
to message exchanges
Sign only specific portions of XML
Uses other two standards of W3C
XML-Signature
XML-Encryption
WS-Security
SOA and Quality Attributes
SOA and Quality Attributes
Interoperability
Performance
Decreases the performance
Service discovery Overhead of SOAP Solutions Load balancing Stateful services
Security
HTTPS (network level)SOA and Quality Attributes
Reliability
Consumers have different requirements about reliability
Related to transport protocol
HTTPR, MOM, ...
WS-Reliability
Replication
Location Transparency
UDDI, P2P
Impact positevely and negatively on peformance
SOA and Quality Attributes
Availability
Service-Level Agreements (SLAs)
Replication
Scalability
Horizontal scaling
add new hardware, making load-balancing
Vertical scaling
upgrade the hardware, increasing the capacity of a server Grid Computing and P2P
SOA and Quality Attributes
Testability
Black-box approach
Services can be composed by other services,
running in several machines with different
contexts
Services may be discovered at runtime
Development tools try to protect developers
from the task of dealing with XML-based
standards of Web Services
SOA and Quality Attributes
Reusability
Service repository (UDDI?)
Such as CBD approach, reusable services
should be carefully specified, designed,
implemented, and documented
SOA Methodologies
SOA Methodologies
SOA Delivery Lifecycle [Erl, 2005]
SOA Methodologies
SOUP (Service-Oriented Unified Process)
Service-Oriented Design
Service-oriented modeling requires additional
activities and artifacts that are not found in
traditional object-oriented analysis and design
[Arsanjani, 2004]
Methods
SOMA (IBM)
Service-Oriented Design
Approaches
Erl’s Approach
Erl’s Approach
Erl’s Approach
Analysis phase
Define business requirements: The business
requirements related to scope of the solution are collected to begin the analysis process.
Identify automation systems: Existing application
logic that already attends some requirements identified in step 1 needs to be identified.
Model candidate services: The concept of service
modeling process is introduced. The service operation candidates are identified and then grouped into a logical context.
Erl’s Approach
Model Candidate Services
Decompose the business process Business process models Identify business service operation candidates Abstract orchestration logic Operation candidates Create business service candidates
Refine and apply principles of service-orientation Identify candidate service compositions Revise business service operation grouping Analyze application processing requirements Identify application service operation candidates Create application service candidates Revise candidate service compositions Revise application service operation grouping Business Service Candidates Business Service Candidates Service compositions Service candidates model Processing requirements Application service operation candidates Application service candidates
Erl’s Approach
Design phase
Compose SOA
Design services
Entity-centric business service design process Application service design process
Task-centric business service design process
Design service-oriented business process
SOA and BPM
SOA and BPM
BPM will become the driver for SOA
implementation [Gartner]
Combining BPM and SOA will help
creating services that can be reused
throughout the organization
Service-Oriented Architecture
Good way to build
business applications
Business process
in its entirety can be viewed
and modeled as a
service
[Erl, 2005]Service Reuse
Business Process Reuse
SOA and BPM
BPM Ingredients
Process design
Captures existent processes Using of visual tools
Process execution
Manages the operational execution of the
processes
"Run what I just drew!"
Process monitoring
Examines the status of the execution and statistics
SOA and BPM
SOA and BPM
Service-Oriented Architecture
SOA and
Business
Process
[Havey, 2005]BPMN
Business Process Modeling Notation
BPMN
Proposed by BPMI (Business Process Management
Initiative)
Fusion between BPMI and OMG to improve efforts in business process field
Combination of the best ideas in unique diagram
Easy comprehension among stakeholders: consumers, process analystis, developers, etc.
Designed to overcome the distance between processo modeling and implementation
Mapping to execution languages
BPML (Business Process Modeling Language)
BPEL4WS (Business Process Execution Language for
BPMN
Formation of Notation Working Group
August 2001: Formation of Working group
58 members representing 35 organizations
BPMN 0.9 Draft
November 2002: draft specification 0.9 is published to the public
BPMN 1.0 Draft
August 2003: draft specification 1.0 is published to the public
BPMN 1.0 Final
BPMN
The notation is grouped in following:
Flow objects
Show the activities and the execution flows
Connection objects
Connect the flow objects
Swimlanes (Pool)
Usually is associated to the departaments or
groups
Artifacts
Used to complement (comments)
BPMN – Flow Objects
Events
Something that occurs on the business
process
Begin of process Intermediate event End of processBPMN – Flow Objects
Events
BPMN – Flow Objects
Events
Example 1 Example 2BPMN – Flow Objects
Activities
Subdivides in processes, subprocesses and tasks
BPMN – Flow Objects
Gateways
Used as structures of flow control
BPMN – Flow Objects
Gateways
BPMN – Swimlane
Group the activities considering functional
aspects or responsability (profile or entities)
LaneLane
Po
o
BPMN – Connection Objects
Associations, sequence flows and
message flows
BPMN
Past, Present and Future of SOA
Past, Present and Future
Past, Present and Future
Books
Past, Present and Future
What is being researching?
Research foccusing on the infrastructure, and
network and distributed system issues
Lack of research in software engineering
related to SOA
First Modeling, Design, and Analysis for
Service-oriented Architecture Workshop (2006)