面向服务概述

Download Report

Transcript 面向服务概述

冯志勇
天津大学计算机学院
2008年10月



SOA的定义及其商业和技术价值
面向服务 vs. 面向对象
面向服务的架构 vs. 分布式对象架构

正像上个世纪的对象似的, 服务是一个很酷
的时髦词,但是,今天SOA是一个经常被
人错误地理解的话题.
“My architect thinks it’s service-oriented,
my developers insist it’s object-oriented,
and my analysts wish it would be more
business-oriented. All I can tell you is that
it isn’t what it was before we started
building Web services.”
 对不同的人,服务的含义不同:
◦ 松耦合的软件构件,它们相互通过标准的
Internet技术动态的交互 (Gartner).
◦ 一个有URI识别的软件应用,它的接口和
绑定能够通过XML制品被定义、描述和发
现,并且支持采用基于满足Internetbased protocolsXML消息机制与其它应
用交互A (W3C).
◦ 通过Internet使用开发标准的一段商业逻
辑 (Microsoft).
◦ 通过Web上标准协议提供的,封装好的、
松耦合的、契约化的软件功能
(DestiCorp).
◦ 服务独立于应用程序和运行计算平台的是
自包含的、可重用得软件模块,它有定义
良好的接口,并允许业务任务和需要执行
任务的具体IT构件 1:1 影射。

SOA的定义仍在发展变化.
◦ 一组能够被调用的构件,并且其接口描述能够被
发布和发现 (W3C).
◦ SOA是一种client/server 设计方法,其中的应
用程序由软件服务和软件服务消费者组成 (also
known as clients or service requesters).
SOA 不同于一般的client/server 模式,其定义
强调软件构件中的松耦合,并且采用分离的接
口 (Gartner).
◦ SOA是一个业务驱动的IT架构方法,它可以把
业务集成为连接的可重复的商业任务或服务.
SOA使得 IT系统能够快速、容易和经济的适应
业务需求的迅速改变,从而有助于今天的业务
创新. SOA协助客户增强他们业务过程的灵活性,
强化了其底层基础结构,通过在不同的应用和
信息资源之间建立连接重用其原有的IT 投资。
(IBM)
A New Way of Thinking

Take a CD for instance. If you want to play
it, you put your CD into a CD player and the
player plays it for you. The CD player offers
a CD playing service. Which is nice because
you can replace one CD player with another.
You can play the same CD on a portable
player or on your expensive stereo. They
both offer the same CD playing service, but
the quality of service is different.
2015/7/20
8
The SOA Story
Application 1
Application 2
Business
Process
Auto-searchable
Found
Service broker
Services
Registration
Registration
Registration
Component
Library
Organization X
Organization Y
Organization Z
2015/7/20
9
Research &
Development
Marketing
Distributed Data
Distributed Computation
Distributed users
…..
Research &
Development
Marketing
Accounting
Customer Service
Manufacturing
Accounting
Sales
Customer Service
Manufacturing
Sales
2015/7/20
10
– 互操作问题
– 异构的网络协议
– 异构的硬件平台
– 异构的操作系统
– 异构的应用程序格式……
There must be consensus
On 互操作性!
2015/7/20
11
Changing Market Dynamics
On Demand
Static
Business
Technology
Business process decision-making Fixed Costs
Rigid organizational structure
Proprietary systems
Slow and steady economic growth Labor-intensive
Long-term product lifecycle
Users adapt to technology
Passive operational risk management
Collaborative, integrated value nets Variable costs
Dynamic, adaptive, learning
Open, integrated systems
Unpredictable fluctuations
Self-healing, self-managing system
Shortening product lifecycle
Technology adapts to users
Proactive risk management
Increased focus on privacy and security
2015/7/20
12
2015/7/20
13

新机遇

节约成本

敏捷业务
◦ 产品创新和服务从关键的特色赢得竞争优势.
◦ 传统技术适应新商业模型的能力,从而使更多的渠道来获得收入。
◦ 通过削减整体花费降低成本。
◦ 由于恶性竞争,每一个错过的商业机会的企业职位低于其竞争对手。 有能
力的企业能够快速应对各种业务的刺激将是关键的生存。
◦ 更快的上市时间,提高客户满意度,还客户的忠诚度。这样的结果是增加
了商业和更高的收入。
◦ 能够提供按需服务,实时24 / 7 。
◦ 无缝协作的合作伙伴和客户有助于提高服务质量和上市时间。
2015/7/20
14
 使得互操作成为IT应用的固有特征.
 提供了一个
time-to-market 快
速方法
 快速响应业务条件变化
 降低了重复性工作,最大化已存在
系统的价值
2015/7/20
15

开放Openness
◦ 对一个组织而言,依赖于它几乎无法控制外部技术和平台供应商是
危险的。然而,采用开放的标准减轻这一风险。

节约成本Cost Saving
◦ 减少维护费用
◦ 增加重用IT投资,以提高生产力,从而提高投资回报率(ROI).

敏捷Agility
◦ 松耦合增加应用的灵活性,并降低新的应用程序产品上市时间。
◦ 无缝的可扩展性以最低成本,以满足季节性增加负荷。
2015/7/20
16

软件体系结构设计原则
◦
◦
◦
◦
抽象
关注点分离
预期变化
设计重用
2015/7/20
17
Enterprise
Integration
Object
Oriented
BPM
SOA
CBSD
Web
Application
Distributed
Computing
CBSD: Component-Based Software Development
BPM: Business Process Management
2015/7/20
18
Distributed
Computing
Client/Server
WSDL
CORBA
NFS
VT3270
MQ
RPC
EJB
VT100
EAI
SOAP
TCP/IP
WWW
Program
Paradigm
COBOL
SOA
Stored Procedure
Modular2
Pascal
Smalltalk
Java
PROLOG
Ada
SIMULA
Assembler
1950
1960
1970
C#
C++
1980
1990
2000
2015/7/20
19









基于开放标准
鼓励固有的内在重用
鼓励强调互操作性的
可扩展性
根本上自主
促进动态发现
促进架构的组合性
促进整个企业松散耦合
支持逐步实施
2015/7/20
20








Improved Integration, intrinsic interoperability
Inherent reuse
Streamlined architectures and solutions
Leveraging the legacy investment
Establishing standardized XML data representation
Focused investment on communications
infrastructure
Best-of-breed alternatives
Organizational agility
2015/7/20
21



The business drives the services, and the
services drive the technology.
Business agility is a fundamental business
requirement.
A successful SOA is always in flux.
2015/7/20
22
W3C
OASIS
WS-I
Established
1994
1993 as SGML
Open, 1994 as
OASIS
2002
Approximate
membership
400
600
200
SOA goal
To further the evolution of
the Web, by providing
fundamental standards that
improve online business
and information sharing.
To promote online
trade and commerce
via specialized Web
services standards.
To foster
standardized
interoperability
using Web
services
standards.
SOA
deliverables
XML, XML Schema,
XQuery, XML Encryption,
XML Signature, XPath,
XSLT, WSDL, SOAP, WSCDL, WS-Addressing, Web
Services Architecture
UDDI, ebXML,
SAML, XACML,
WS-BPEL, WSSecurity
Basic Profile,
Basic Security
Profile
2015/7/20
SOA Standards Organizations
23

几个面向服务的原则源自面向对象的原则

一些面向对象的原则,如继承权,不符合面向服
务的世界。
一些面向服务的原则,如松耦合和自主,不直接
来自面向对象。

◦
◦
◦
◦
◦
abstraction
Encapsulation
Interface first
Composition
Statelessness
-- decomposition
-- Reusability
-- Loose coupling
-- Autonomy
-- Discoverability
2015/7/20
25
Service-Orientation
Loose coupling between
units of processing logic.
Object-Orientation
Based on predefined class dependencies,
resulting in more tightly bound objects.
oarse-grained interfaces (service description)
Fine-grained interfaces (APIs), Communicatio
Message-based communication
based on RPC or local API calls.
Large unit of processing logic (service),
Unit of logic (object) tend to be smaller and
May vary significantly in scope.
More specific in scope.
Promotes the creation of activity-agnostic
Encourages the binding of processing logic
units of processing logic (services) that are
with data, resulting in highly intelligent
driven into action by intelligent units of
units (object).
communication (message).
efers that units of processing logic (services)
Promotes binding of data and logic, resulting
designed to remain as stateless as possible.
In the creation of more stateful units (objects
2015/7/20
26
Programming
Language
Object-Oriented
Concept &
Architecture
Simula
Smalltalk
Objective C
C++
Java
Standard
Specification
Service-Oriented
Concept &
Architecture
XML
UDDI
ebXML
WSDL
SOAP
OWL
Modeling
UML
Modelin
g
BPEL
WSFL
XLANG
Technology &
Methodology
OOAD
OO Framework
OODB
OO Process model
Technology &
Methodology
MDA
SO Framework
Ontology / Service DB
SO lifecycle process
2015/7/20
27


SOA彻底背离客户服务器结构。目前SOA仍采用
一些最初用于建立客户机服务器应用程序的技术。
引入SOA更为复杂,与简单的两层客户机服务器
架构形成鲜明对比
分布式互联网架构有许多共同之处与SOA ,其中
包括大量的技术。然而, SOA有鲜明的特色有关
技术和它的基本设计原则。
2015/7/20
29
Two Tier with
Thin Client
Two Tier with
Fat Client
Client
Client
Client
Data Management
Application Processing
Presentation
Application Processing
Presentation
Three Tier
Server
Presentation
Server
Data Management
Server
Server
Application
Processing
Data
Management
2015/7/20
30

RPC-based

Remote Object based

Web based
◦ Client and middleware server is tightly coupled
◦ Remote objects communicates through standard
interface languages
◦ Object models: OMG CORBA, SUN Java RMI, MS
DCOM
◦ Browser + “Dynamic content generation”
◦ Enabling techniques: CGI, Java Servlet/JSP, MS ASP
2015/7/20
31

Coupled with a powerful communications
infrastructure, distributed objects divide
monolithic client/server applications into
self-managing components, or objects, that
can interoperate across disparate networks
and operating systems.
◦ SUN J2EE
 JavaTM 2 Platform, Enterprise Edition
◦ MS DCOM
 Distributed Component Object Model
◦ OMG CORBA
 Common Object Request Broker Architecture
2015/7/20
32

In a distributed computing system, middleware is
defined as the software layer that lies between the
operating system and the applications on each site
of the system. It serves to "glue together" or
mediate between separate components.
Objectives

Examples

◦
◦
◦
◦
Hiding distribution
Hiding the heterogeneity
Providing uniform, standard, high-level interfaces
Supplying a set of common services
◦ Transaction processing monitors
◦ Data converters
◦ Communication controllers
2015/7/20
33

Design Challenges
◦
◦
◦
◦
◦
Performance
Scalability
Complexity of administration
Mobility and dynamic reconfiguration
Global information network to manage large
applications that are heterogeneous, widely
distributed and in permanent evolution
2015/7/20
34

OMG Standard, “to allow applications to
communicate with one another no matter
where they are located or who has designed
them”
◦ 1991, CORBA 1.1, IDL & API within an ORB
◦ 1994, CORBA interoperability & IIOP (Internet InterORB Protocol)
◦ 2002, CORBA Component Model
2015/7/20
35


Distributed object computing middleware that
shields applications from heterogeneous platform
dependencies.
To simplify development of distributed applications
by automating/encapsulating
◦
◦
◦
◦
◦
◦
◦
◦

Object location
Connection & memory mgmt.
Parameter (de)marshaling
Event & request demultiplexing
Error handling & fault tolerance
Object/server activation
Concurrency
Security
CORBA defines interfaces, not implementations
2015/7/20
36

Object Request Broker: enables objects to transparently make
and receive requests and responses in a distributed
environment.
◦ The core of the reference model, “telephone exchange”

Object Services: a collection of services (interfaces and
objects) that support basic functions for using and
implementing objects.
◦ e.g. Naming, Trading, and Life Cycle Service

Common Facilities: a collection of services that many
applications may share, but which are not as fundamental as
the Object Services
◦ e.g. e-mail facility

Application Objects: products of a single vendor on in-house
development group that controls their interfaces.
2015/7/20
37
Application
Objects
Domain
Facilities
Horizontal
CORBA
Facilities
Object Request Broker
Domain Facilities
2015/7/20
38
Interface
Repository
IDL
Compiler
Client
Dynamic
Invocation
ORB Core
IDL
Stub
Implementation
Repository
Object
ORB
Interface
IDL
Dynamic
Skeleton Skeleton
Object
Adapter
GIOP/IIOP/ESIOPS
2015/7/20
39

A logical set of services
◦ Locates the remote object, communicates the
request, waits for the results and when available
communicates the results back to the client
◦ Location transparency
◦ Programming language independent: interface
translation and language binding
Client
Object
Object Request Broker (ORB)
2015/7/20
40

Language neutral, Language mapping
◦
◦
◦
◦
Modularized object interface
Operations and attributes that an object supports
Exceptions raised by an operation
Data types of an operation return value, its
parameters, and an object’s attributes
Client
Object
IDL
Stub
IDL
Skeleton
Object Request Broker (ORB)
2015/7/20
41
Activate
server
Implementation 1S
Repository
In args
Client Obj. ref.
1C
Return
Control
to Client
Wait for
request
to
complete
4C
IDL
Stub
3C 2
C
Operation ()
Out args + return value
Locate target
object
Return
Request
Send request to
server
Object
IDL
Skeleton
4S 2S
3S
Process Request
Activate Object’s
Servant
ORB CORE
2015/7/20
42

动机
◦ ORB implementation diversity
◦ ORB boundaries:




Partition the environment into different ORBs
Simplified test, management, and maintenance
Decentralized control
e.g. internet ORB, company ORB
◦ ORB vary in scope, distance and lifetime
 e.g. archives ORB, game ORB

单元
◦ Inter-ORB Bridge: transactions between ORB domains
◦ General Inter-ORB Protocol (GIOP): ORB-ORB
interactions over connection-oriented transport
protocol
◦ Internet Inter-ORB Protocol (IIOP): ORB-ORB
communication across the Internet (TCP/IP)
2015/7/20
43
Client
Object
Client
IDL
Stub
IDL
Skeleton
IDL
Stub
ORB 1
IIOP
Object
IDL
Skeleton
ORB 2
Interoperability uses ORB-to-ORB communication
2015/7/20
44
Services
Description
Object Life Cycle
Define how CORBA objects are created, removed, moved and copied
Naming
Define how CORBA objects can have friendly symbolic names
Events
Decouple the communication between distributed objects
Relationships
Provides arbitrary typed n-ray relationships between CORBA objects
Externalization
Coordinates the transformation of CORBA objects to and from external
media
Transactions
Coordinates atomic access to CORBA objects
Concurrency Control
Provides a locking service for CORBA objects in order to ensure serialized
access
Property
Supports the association of name-value pairs with CORBA objects
Trading
Supports the finding of CORBA objects based on properties describing the
services offered by the object
Query
Support queries on objects
2015/7/20
45

A platform for developing applications
◦
◦
◦
◦
◦
◦
◦
◦
Oct. 1994, Public introduction of Java
Jan. 1996, JDK 1.0 released
Apr. 1997, EJB specification announced
Dec. 1998, Java 2, SDK 1.2 released
Jun. 1999, J2EE announced
Dec. 1999, J2EE platform released
Sep. 2001, J2EE 1.3 released
Nov. 2003, J2EE 1.4 released
2015/7/20
46
J2EE Application Architecture
Client Side
Presentation
Server Side
Presentation
Server Side
Business Logic
Browser
Web
Server
JSP
EJB
Contain
er
EJB
JSP
EJB
Java
Application
Java
Servlet
EJB
Other Device
J2EE
platform
J2EE
platform
Pure
HTML
Java
Applet
Enterprise
Information
System
Desktop
J2EE
Client
2015/7/20
47
2015/7/20
48
2015/7/20
49











HTTP/HTTPS
JAAS – Java Authorization and Authentication
Service
JTA – Java Transaction API
JNDI – Java Naming and Directory Service
RMI-IIOP
JDBC – Java DataBase Connectivity
JMS – Java Message Service
JavaMail
JAXP – Java API for XML Parsing
Java IDL
……
2015/7/20
50




It allows the system designer to delay
decisions on where and how services should
be provided
It is a very open system architecture that
allows new resources to be added to it as
required
The system is flexible and scaleable
It is possible to reconfigure the system
dynamically with objects migrating across
the network as required
2015/7/20
51

紧耦合

自有
◦ Both ends of each distributed computing link had
to agree on the details of the API. A code change
to a COM object, for example, required
corresponding changes to the code accessing
that object.
◦ Microsoft controlled DCOM
◦ Implementing a CORBA architecture typically
necessitated the decision to work with a single
vendor's implementation of the specification.
2015/7/20
52

SOA is developed upon the weaknesses of
distribute object computing technique.
◦ 基于标准
 Reliance upon universally accepted standards provides
broad interoperability among different vendors’ solutions
◦ 松耦合
 Separates the participants in distributed computing
interactions so that modifying the interface of one
participant in the exchange does not break the other.
2015/7/20
53

SOA通过松耦、满足标准的互联网协议可重用的
软件组件合动态协作。

SOA是业务和技术需求驱动的,即,开放性的合
作,节约成本和动态的变化灵活性。

SOA来自其它软件技术,包括分布式对象计算,
基于构件的软件工程和企业应用集成
2015/7/20
54






M. P. Singh and M. N. Huhns, “Service-Oriented
Computing”, John Wiley & Sons, 2005.
Thomas Erl, “Service-Oriented Architecture:
Concepts, Technology, and Design”, Prentice Hall,
2005.
Eric Newcomer and Greg Lomow, “Understanding
SOA with Web Services”, Addison Wesley, 2005.
D. Krafzig, K. Banke and D. Slama, “Enterprise SOA:
Service-Oriented Architecture Best Practice”,
Prentice Hall, 2005.
Wei-Tek Tsai, “What is SOA? Why should you care?”,
Tsinghua University Short Course on ServiceOriented Computing and Architecture, 2006.
Jen-Yao Chung, “Service-Oriented Architecture and
Web Services”, keynote speaking, SOSE 2005.
2015/7/20
55








Jason Bloomberg, “Principles of SOA”, Feb. 2003.
“A Practical Guide to SOA for IT Management”,
Systinet Corp. 2005.
Shireesh Jayashetty, Pradeep Kumar M, “Adopting
Service Oriented Architecture increases the
flexibility of your enterprise”, Infosys, 2006.
Ian Summerville, “Software Engineering” (6th
Edition), Addison-Wesley, 2000.
ObjectWeb, http://middleware.objectweb.org/
OMG, http://www.omg.org/
Doug Schmidt’s CORBA page,
http://www.cs.wustl.edu/~schmidt/corba.html
IBM SOA glossary, http://www306.ibm.com/software/solutions/soa/glossary/ind
ex.html
2015/7/20
56