1、企业级应用系统体系架构(八) SOA概述,Chen HaopengTuesday, October 16, 2018,References:IBM Redbook: Patterns Service Oriented Architecture and Web Services,1,The business drivers for a new approach,While IT executives have been facing the challenge of cutting costsmaximizing the utilization of existing technologyAt
2、the same time they have tocontinuously strive to serve customers betterbe more competitivebe more responsive to the businesss strategic priorities.There are two underlying themes behind all of these pressures: Heterogeneity and change,The business drivers for a new approach,Heterogeneity Most enterp
3、rises today contain a range of different systems, applications, and architectures of different ages and technologies. Integrating products from multiple vendors and across different platforms were almost always a nightmare. But we also cannot afford to take a single-vendor approach to IT, because ap
4、plication suites and the supporting infrastructure are so inflexible.ChangeGlobalization and e-business are accelerating the pace of change.Improvements in technology continue to accelerate, feeding the increased pace of changing customer requirements.,The business drivers for a new approach,As a re
5、sult, business organizations are evolving from the vertical, isolated business divisions of the 1980s and earlierto the horizontal business-process-focused structures of the 1980s and 1990stowards the new ecosystem business paradigm. Business services now need to be componentized and distributed. Th
6、ere is a focus on the extended supply chain, enabling customer and partner access to business services.,The business drivers for a new approach,Questions:How do I make my IT environment more flexible and responsive to the ever changing business requirements? How can we make those heterogeneous syste
7、ms and applications communicate as seamlessly as possible?How can we achieve the business objective without bankrupting the enterprise?Currently many IT executives and professionals alike believe that now we are getting really close to providing a satisfactory answer with service-oriented architectu
8、re.,The business drivers for a new approach,In order to alleviate the problems of heterogeneity, interoperability and ever changing requirements, such an architecture should provide a platform for building application services with the following characteristics: Loosely coupled Location transparent
9、Protocol independentBased on such a service-oriented architecture, a service consumer does not even have to care about a particular service it is communicating with because the underlying infrastructure, or service “bus”, will make an appropriate choice on behalf of the consumer. The infrastructure
10、hides as many technicalities as possible from a requestor. Particularly technical specificities from different implementation technologies such as J2EE or .NET should not affect the SOA users. We should also be able to reconsider and substitute a “better” service implementation if one is available,
11、and with better quality of service characteristics.,Service-oriented design,important service-oriented terminology:Services: Logical entities, the contracts defined by one or more published interfaces.Service provider: The software entity that implements a service specification.Service consumer (or
12、requestor): The software entity that calls a service provider. Traditionally, this is termed a “client”. A service consumer can be an end-user application or another service.,Service locator: A specific kind of service provider that acts as a registry and allows for the lookup of service provider in
13、terfaces and service locations.Service broker: A specific kind of service provider that can pass on service requests to one or more additional service providers.,Interface-based design,In both component and service development, the design of the interfaces is done such that a software entity impleme
14、nts and exposes a key part of its definition. Therefore, the notion and concept of “interface” is key to successful design in both component-based and service-oriented systems. The following are some key interface-related definitions:Interface: Defines a set of public method signatures, logically gr
15、ouped but providing no implementation. An interface defines a contract between the requestor and provider of a service. Any implementation of an interface must provide all methods.Published interface: An interface that is uniquely identifiable and made available through a registry for clients to dyn
16、amically discover.Public interface: An interface that is available for clients to use but is not published, thus requiring static knowledge on the part of the client.Dual interface: Frequently interfaces are developed as pairs such that one interface depends on another; for example, a client must im
17、plement an interface to call a requestor because the client interface provides some callback mechanism.,Interface-based design,The following figure shows the UML definition of a customer relationship management (CRM) service, represented as a UML component, that implements the interfaces AccountMana
18、gement, ContactManagement, and SystemsManagement. Only the first two of these are published interfaces, although the latter is a public interface. Note that the SystemsManagement interface and ManagementService interface form a dual interface.,Layered application architectures,Object-oriented techno
19、logy and languages are great ways to implement components. While components are the best way to implement services, though one has to understand that a good component-based application does not necessarily make an good service-oriented application. The term “the application edge” reflects the fact t
20、hat a service is a great way to expose an external view of a system, with internal reuse and composition using traditional component design.,A closer look at service-oriented architecture,Service-oriented architecture presents an approach for building distributed systems that deliver application fun
21、ctionality as services to either end-user applications or other services. It is comprised of elements that can be categorized into functional and quality of service.,A closer look at service-oriented architecture,Functional aspects include:Transport is the mechanism used to move service requests fro
22、m the service consumer to the service provider, and service responses from the service provider to the service consumer.Service Communication Protocol is an agreed mechanism that the service provider and the service consumer use to communicate what is being requested and what is being returned.Servi
23、ce Description is an agreed schema for describing what the service is, how it should be invoked, and what data is required to invoke the service successfully.Service describes an actual service that is made available for use.Business Process is a collection of services, invoked in a particular seque
24、nce with a particular set of rules, to meet a business requirement. Note that a business process could be considered a service in its own right, which leads to the idea that business processes may be composed of services of different granularities.The Service Registry is a repository of service and
25、data descriptions which may be used by service providers to publish their services, and service consumers to discover or find available services. The service registry may provide other functions to services that require a centralized repository.,A closer look at service-oriented architecture,Quality
26、 of service aspects include:Policy is a set of conditions or rules under which a service provider makes the service available to consumers. There are aspects of policy which are functional, and aspects which relate to quality of service; therefore we have the policy function in both functional and q
27、uality of service areas.Security is the set of rules that might be applied to the identification, authorization, and access control of service consumers invoking services.Transaction is the set of attributes that might be applied to a group of services to deliver a consistent result. For example, if
28、 a group of three services are to be used to complete a business function, all must complete or none must complete.Management is the set of attributes that might be applied to managing the services provided or consumed.,SOA collaborations,The following figure shows the collaborations in a service-or
29、iented architecture. The collaborations follows the “find, bind and invoke” paradigm.A service consumer performs dynamic service location by querying the service registry for a service that matches its criteria.If the service exists, the registry provides the consumer with the interface contract and
30、 the endpoint address for the service.,SOA collaborations,The roles in a service-oriented architecture are:Service consumer: The service consumer is an application, a software module or another service that requires a service. It initiates the enquiry of the service in the registry, binds to the ser
31、vice over a transport, and executes the service function. The service consumer executes the service according to the interface contract.Service provider: The service provider is a network-addressable entity that accepts and executes requests from consumers. It publishes its services and interface co
32、ntract to the service registry so that the service consumer can discover and access the service.Service registry: A service registry is the enabler for service discovery. It contains a repository of available services and allows for the lookup of service provider interfaces to interested service con
33、sumers.Each entity in the service-oriented architecture can play one (or more) of the three roles of service provider, consumer and registry.,SOA collaborations,The operations in a service-oriented architecture are:Publish: To be accessible, a service description must be published so that it can be
34、discovered and invoked by a service consumer.Find: A service requestor locates a service by querying the service registry for a service that meets its criteria.Bind and invoke: After retrieving the service description, the service consumer proceeds to invoke the service according to the information
35、in the service description.The artifacts in a service-oriented architecture are:Service: A service that is made available for use through a published interface that allows it to be invoked by the service consumer.Service description: A service description specifies the way a service consumer will in
36、teract with the service provider. It specifies the format of the request and response from the service. This description may specify a set of preconditions, post conditions and/or quality of service (QoS) levels.,SOA collaborations,In addition to dynamic service discovery and definition of a service
37、 interface contract, a service-oriented architecture has the following characteristics:Services are self-contained and modular.Services support interoperability.Services are loosely coupled.Services are location-transparent. Services are composite modules, comprised of components.These characteristi
38、cs are also central to fulfilling the requirements for an e-business on demand operational environment.,Finally, service-oriented architecture is not a new notion.,Services vs. components,A service is a coarse-grained processing unit that consumes and produces sets of objects passed-by-value. It is
39、not the same as an object in programming language terms. Instead, it is perhaps closer to the concept of a business transaction such as a CICS or IMS transaction than to a remote CORBA object.A service consists of a collection of components that work in concert to deliver the business function that
40、the service represents. Thus, in comparison, components are finer-grained than services. In addition, while a service maps to a business function, a component typically maps to business entities and the business rules that operate on them. As an example, let us look at the Purchase Order component m
41、odel for the WS-I Supply Chain Management sample.,Services vs. components,In a component-based design, components are created to closely match business entities (such as Customer, Purchase Order, Order Item) and encapsulate the behavior that matches the entities expected behavior.Purchase Order comp
42、onent provides functions to obtain information about the list of products ordered and the total amount of the orderItem component provides functions to obtain information about the quantity and price of the product ordered.,In a service-oriented design, services are not designed based on business en
43、tities. Instead, each service is a holistic unit that manages operations across a set of business entities. For example, a customer service will respond to any request from any other system or service that needs to access customer information. The customer service can process a request to update cus
44、tomer information; add, update, delete investment portfolios; and enquire about the customers order history. The customer service owns all the data related to the customers it is managing and is capable of making other service inquiries on behalf of the calling party in order to provide a unified cu
45、stomer service view.This means a service is a manager object that creates and manages its set components.,Service-oriented architecture benefits,With a service-oriented architecture, we can realize several benefits to help organizations succeed in the dynamic business landscape of today:Leverage exi
46、sting assets.Easier to integrate and manage complexity.More responsive and faster time-to-market.Reduce cost and increase reuse.Be ready for what lies ahead.Service-oriented architecture is by no means a silver bullet, and migration to SOA is not an easy task. Rather than migrating the whole enterpr
47、ise to a service-oriented architecture overnight, the recommended approach is to migrate an appropriate subset of business functions as the business need arises or is anticipated.,SOA的疑问,在我的系统中,所有的功能都包装成了Web Service,现在我的系统是否就是SOA架构了?协议独立、位置透明、松散耦合高度动态性,SOA的疑问,Services 与 Components的差异是什么?问题域 vs. 解决域集
48、成方式我们的机遇,863计划信息技术领域2007年度专题课题申请指南(节选),专题一:智能感知与先进计算技术专题What is Software Architecture探索导向类课题8服务计算技术主要研究内容(可从以下内容中选择其一申请课题):(1)服务描述与发现、可信的服务资源组织与管理;(2)可靠的服务组合方法与验证;(3)动态的服务组合。说明与要求:要求完成相应的软件原型系统;获得软件著作权和申请专利,或以开放源码形式发布。,Classic SOA Layers,Models of SOAD,JBI(Java Business Integration)2005.8 JSR 208为JB
49、I组件(包括服务引擎和绑定组件)的开发者建立一套标准的服务提供者接口SPI。抽象的协议无关的消息交换和规格化消息。提供一套标准的JBI组件间消息交换机制。建立一个标准来封装JBI组件,并为这些组件部署服务。定义一些管理监控挂钩(hooks),用于以后开发针对各种特定问题域的标准工具。提供服务引擎和绑定组件实现的复杂性和多样性。允许不同的供应商发布JBI组件,这些组件之间能够可靠地互操作,由这些组件(在JBI基础设施之上)构建的系统可以集中管理。,28,Models of SOAD,JBI(Java Business Integration),29,Models of SOAD,SCA(Serv
50、ice Component Architecture)/SDO(Service Data Object) SCA定义了如何创建服务组件以及如何将服务组件组装成业务解决方案的通用方法。SCA由一系列规范组成, 包括说明如何用某种具体语言(如Java、C+、Spring、BPEL等)实现业务服务组件的组件实现(Component Implementation)规范;如何定义组合服务组件结构的装配(Assembly)模型;如何使用各种访问方法(如Web services、JMS、RMI-IIOP、REST等)的绑定(Binding)规范;如何将基础设施服务(如安全、事务、可靠消息等)加到解决方案的策略框架(Policy Framework)SDO(Service Data Object) 提供了一种通用的数据编程架构和API,SCA组件可以通过传递服务数据对象来交换数据。SDO 体系结构中的基本概念主要有数据对象(Data Object)、数据图(data graph)和数据访问服务DAS(Data Access Services)。,