(SOA ارﮔ سﯾورﺳ...
-
Upload
hoangthuan -
Category
Documents
-
view
220 -
download
2
Transcript of (SOA ارﮔ سﯾورﺳ...
ا سرویس گرپروتکل های معماری (SOA)
...شرکت دوره آموزشی امیر مهجوریان
رامدیر فنی آزمایشگاه معماری سازمانی سرویس گمدیرعامل شرکت دانش بنیان کاریز سیستم
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
2SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
(طی هفت جلسه)سر فصل کلی مطالب
معرفی معماری سرویس گرا1.
کاربرد معماری سرویس گرا2.
شناخت تفصیلی ادبیات کسب و کار3.
پروتکل های معماری سرویس گرا4.
متد تحلیل و طراحی سرویس گرا5.
شناخت تفصیلی معماری سرویس گرا 6.
ابزارها و پیاده سازی معماری سرویس گرا7.
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
3SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
SOA Server, Users and UDDI
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
4SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
The Web Services Stack
Network (HTTP, FTP, …)
XML Messaging (SOAP, XML)
Service Description (WSDL)
Service Publication and Discovery (UDDI)
Service Flow (BPEL4WS)
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
5SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
ASP.NET Web Service example
<%@ WebService Language="VB" Class="TempConvert" %>
Imports System
Imports System.Web.Services
Public Class TempConvert :Inherits WebService
<WebMethod()> Public Function FahrenheitToCelsius (ByVal Fahrenheit As Int16) As Int16
Dim celsius As Int16
celsius = ((((Fahrenheit) - 32) / 9) * 5)
Return celsius
End Function
<WebMethod()> Public Function CelsiusToFahrenheit
(ByVal Celsius As Int16) As Int16
Dim fahrenheit As Int16
fahrenheit = ((((Celsius) * 9) / 5) + 32)
Return fahrenheit
End Function
End Class
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
6SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
ASP.NET Web Service example
This Code is a .asmx file. This is the ASP.NET file extension for XML
Web Services.
The only difference from a normal application is that this function is
defined as a "WebMethod".
Use "WebMethod" to mark the functions in your application that you
would like to make into web services.
The ASP.NET has automatically created a WSDL and SOAP
request.
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
7SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
XML
eXtensible Markup Language
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
8SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
The XML Basics
eXtensible Markup Language (XML) is a super set of HTML. A user can define his /her own tags in XML.
Any XML documents must conform their metadata such as Document Type Definition (DTD) or Schema which specifies complex data types, elements and its attributes, and its sub-elements, etc.
A XML document is a universal format document typeused for data exchange and data storage. XML is also widely used for deployment descriptors and configuration specifications.
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
9SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
A Question !?
Convert a “Data” record from Database or any other
Storage to Text Base Format , So it can easily
Understand and Import/Export between
Systems (Platforms, Storages) ..???
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
10SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
A simple XML document about student GPA record.
<?xml version = “1.0”?>
<students>
<student id=1234>
<name>John Smith</name>
<gpa>3.5</gpa>
</student>
<student id=2345>
<name>Scott Tiger</name>
<gpa>4.0</gpa>
</student>
</students>
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
11SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
HTML
<body>
<h1>My Favorite Book</h1>
<h1>ISBN - 1-34567-04-01</h1>
<H1>Authors:</H1>
<h3>John Smith</h1>
<h3>Peter Chen</h1>
<h1>Price: $45.00</h1>
<h1>Description: This is a grerat book</h1>
</body>
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
12SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
XML
<?xml version="1.0" ?>
<Books>
<Book>
<ISBN>1-34567-04-01</ISBN>
<Authors>
<AuthorName>John Smith</AuthorName>
<AuthorName>Peter Chen</AuthorName>
<AuthorName>David Chao</AuthorName>
</Authors>
<Price> $45.00</Price>
<Description>This is a grerat book</Description>
</Book>
<Book>
<ISBN>1-34567-04-02</ISBN>
<Authors>
<AuthorName>Adam Smith</AuthorName>
</Authors>
<Price> $25.00</Price>
<Description>This is a second great book</Description>
</Book>
</Books>
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
13SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
HTML vs XML
HTML is a language specifically designed for displaying information in browser. It doesn’t carry information about the structure of the content held within its page.
XML (Extensible MarkUp Language) is a language used to represent data in a form that does not rely on any particular proprietary technology. It uses user-defined tags to give meaningful names to data elements. With XML, we separate the data content from the data presentation.
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
14SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
Tree View of XML
Books
Book
ISBN Authors Price Description
Book
ISBN Authors Price Description
Author Author Author
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
15SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
The XML Basics
This XML document shows two student records. Each record consists of student name and his/her grade point average (gpa).The tag students is a top level root element which has a number of sub-elements called student.
Each student element consists of two sub-elements called nameand gpa. The identifier id in student tag is an attribute of element student.
The tag “?” is a Processing Instruction (PI) to inform XML parser that this XML document must conform XML v. 1.0.
Every XML document must have its metadata just like a data record in a data table of any database must satisfy the definition of the table which is called schema in database.
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
16SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
The XML Basics (cont.)
Since the DTD itself does not use XML syntax and is not
very flexible. Schema is getting more and more popular
now and is replacing DTD because schema itself is in
XML format.
A XML Schema Document (XSD) is a metadata of a XML
document. XSD specifies the syntax, structure, and
constraints in a corresponding XML including datatype or
complex datatype of elements, attributes of elements.
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
17SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
The XML Basics (cont.)
The following Schema describes the structure of above students
XML document. A complex type can be specified by a complexType
tag as follows:
<element name = “student”>
<complexType>
<element name = “name” type = xsd: string”/>
<element name = “gpa” type = “xsd: float />
</complexType>
</element>
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
18SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
Let’s examine a complete XSD Schema sample.
<?xml version=”1.0” encoding=”UTF-8”?>
<xsd:schema xmlns:xsd=http://www.w3.org/2001/XMLSchema
targetNamespace=http://www.mybooks.org”
xmlns=”http://www.mybooks.org”>
<xsd:elememt name=”student”>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref=”name”/>
<xsd:element ref=“gpa”/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name=”name” type=”xsd:string”/>
<xsd:element name=”gpa” type=”xsd:float”/>
</xsd:schema>
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
19SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
The XML Basics (cont.)
The sequence tag in XSD Schema specifies the order and the
occurrence of sub-elements in their parent element. In this example
name and gpa elements are the sub-elements of the student
element which in turn is an element of the students element.
Of course there may be many students in a students set. The
XMLNS plays a same role as package in Java and namespace in
C++ to prevent naming collisions.
An element name can be qualified with a namespace prefix with a
colon symbol “:”. The idea of combining a namespace URI with a
local name is to make any identifier name in XML universally
unique.
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
20SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
WSDL
Web Service Description Language
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
21SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
WSDL Parts
Types Used to define custom message types
Messages Abstraction of request and response messages that my client and
service need to communicate.
PortTypes Contains a set of operations.
Operations organize WSDL messages.
Bindings Binds the PortType to a specific protocol (typically SOAP over
http).
You can bind one PortType to several different protocols by using more than one port.
Services Gives you one or more URLs for the service.
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
22SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
wsdl:types
Data type definitions needed to define the exchanged
messages
By default, the types are defined in terms of XML
Schema
<definitions .... ><types>
<-- type-system extensibility element --> *</types>
</definitions>
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
23SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
wsdl:types - example
<types>...<xs:element name="ItemSearch">
<xs:complexType><xs:sequence><xs:element name="SubscriptionId" type="xs:string"
minOccurs="0"/><xs:element name="AWSAccessKeyId" type="xs:string"
minOccurs="0"/><xs:element name="AssociateTag" type="xs:string"
minOccurs="0"/><xs:element name="XMLEscaping" type="xs:string"
minOccurs="0"/><xs:element name="Validate" type="xs:string"
minOccurs="0"/><xs:element name="Shared" type="tns:ItemSearchRequest"
minOccurs="0"/><xs:element name="Request" type="tns:ItemSearchRequest"
minOccurs="0" maxOccurs="unbounded"/></xs:sequence>
</xs:complexType></xs:element>...
</types>
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
24SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
wsdl:message
Messages exchanged to provide a service
Messages are simply containers of parts which are defined in terms of the types described in the types
section
<message name="nmtoken"> *<part name="nmtoken" element="qname"?
type="qname"?/> *</message>
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
25SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
wsdl:message - example
<message name="ItemSearchRequestMsg"><part name="body" element="tns:ItemSearch"/>
</message>
<message name="ItemSearchResponseMsg"><part name="body" element="tns:ItemSearchResponse"/>
</message>
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
26SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
wsdl:portType
A portType is a named set of abstract
operations and the abstract messages
involved
<wsdl:portType name="nmtoken"><wsdl:operation name="nmtoken" .... /> * </wsdl:portType>
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
27SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
4 messaging types:
One-way: endpoint receives a message
Request-response: endpoint receives a message, and sends a
correlated message
Solicit-response: endpoint sends a message, and receives a
correlated message.
Notification: endpoint sends a message
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
28SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
wsdl:portType - example
<portType name="AWSECommerceServicePortType">...<operation name="ItemSearch">
<input message="tns:ItemSearchRequestMsg"/><output message="tns:ItemSearchResponseMsg"/></operation>...
</portType>
In addition, a message can be used to communicate a fault:<fault message=”...”/>
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
29SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
wsdl:binding
Extensibility elements allow to specify
Concrete grammar for input, output and fault messages
Concrete per-binding information
Concrete per-operation information
The WSDL specification introduces binding extensions
for:
SOAP
HTTP GET/POST
MIME
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
30SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
wsdl:binding - example
<binding name="AWSECommerceServiceBinding" type="tns:AWSECommerceServicePortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
...
<operation name="ItemSearch"><soap:operation soapAction="http://soap.amazon.com"/><input>
<soap:body use="literal"/></input><output>
<soap:body use="literal"/></output>
</operation>
...
</binding>
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
31SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
wsdl:port
Defines an individual endpoint by specifying an
address for a binding
<wsdl:definitions .... >
<wsdl:service .... > *
<wsdl:port name="nmtoken" binding="qname"> *<-- extensibility element (1) -->
</wsdl:port></wsdl:service>
</wsdl:definitions>
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
32SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
wsdl:port - example
<service name="AWSECommerceService">
<port name="AWSECommerceServicePort"
binding="tns:AWSECommerceServiceBinding">
<soap:address location="http://soap.amazon.com/onca/soap?Service=AWS
ECommerceService"/></port>
</service>
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
33SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
The Picture So Far…
Part
Input Message
Part
Input Message
PartPart
Output Message
portType
Operation
Input
Ouput
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
34SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
Binding Associations to SOAP
Binding SOAP RPC
Operation
WSDL SOAP
SOAP Action
Input
Output
SOAP Body
SOAP Body
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
35SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
Port Associations to Bindings
Binding Service
OperationPort #1
Input
Output
URL #1
URL #2
Port #2
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
36SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
Our Echo Messages
<wsdl:message name="echoResponse">
<wsdl:part name="echoReturn“ type="xsd:string" />
</wsdl:message>
<wsdl:message name="echoRequest">
<wsdl:part name="in0" type="xsd:string" />
</wsdl:message>
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
37SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
EchoService portType
<wsdl:portType name="Echo">
<wsdl:operation name="echo" parameterOrder="in0">
<wsdl:input message="impl:echoRequest"
name="echoRequest" />
<wsdl:output message="impl:echoResponse"
name="echoResponse" />
</wsdl:operation>
</wsdl:portType>
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
38SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
<wsdl:binding name="EchoSoapBinding" type="impl:Echo">
<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="echo">
<wsdlsoap:operation soapAction="" />
<wsdl:input name="echoRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace=“…" use="encoded" />
</wsdl:input>
<wsdl:output name="echoResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace=“…" use="encoded" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
39SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
Ports and Services
<wsdl:service name="EchoService">
<wsdl:port binding="impl:EchoSoapBinding" name="Echo">
<wsdlsoap:address location=“http://..../“ />
</wsdl:port>
</wsdl:service>
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
40SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
WSDL Structure
<service><port><port><port>
<portType><operation><operation><operation>
<binding>[SOAP]
<message>[Request]
<types>[data]
<message>[Response]
<binding>[EJB]
<binding>[…]
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
41SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
SOAP
Simple Object Access Protocol
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
42SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
Simple Object Access Protocol (SOAP)
SOAP is an XML based message exchange protocol specified by
the W3C specification.
SOAP is also a lightweight protocol working in a distributed
heterogeneous environment. Some people simply say that SOAP
= HTTP + XML since SOAP message is an XML-document but it
conforms to a specific XML Schema.
SOAP is used to specify the format of a request and response in
the Web service computing to get and send message via HTTP
port by HTTP POST method.
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
43SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
SOAP (cont.)
Every SOAP message has a required envelope and a message
body. A SOAP envelope identifies an XML document as a SOAP
message.
A SOAP envelope element must have one sub-element which is the
Body element. A Body element of a SOAP message can be data
itself, a name of method be invoked, arguments of the method be
invoked, a SOAP request message, or return results from a SOAP
response message.
A SOAP envelope may also have a header sub element but it is
optional. A header element just gives more metadata about the
message.
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
44SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
SOAP Request Example
POST /StockQuote HTTP/1.1
Host: www.stockquoteserver.com
Content-Type: text/xml; charset="utf-8"
Content-Length: nnnn
SOAPAction: "http://example.org/2001/06/quotes"
<env:Envelope xmlns:env="http://www.w3.org/2001/06/soap-envelope" >
<env:Body>
<m:GetLastTradePrice
env:encodingStyle="http://www.w3.org/2001/06/soap-encoding"
xmlns:m="http://example.org/2001/06/quotes">
<symbol>DIS</symbol>
</m:GetLastTradePrice></env:Body>
</env:Envelope>
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
45SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
SOAP Response Example
HTTP/1.1 200 OK
Content-Type: text/xml; charset="utf-8"
Content-Length: nnnn
<env:Envelope xmlns:env="http://www.w3.org/2001/06/soap-envelope" >
<env:Body>
<m:GetLastTradePriceResponse
env:encodingStyle="http://www.w3.org/2001/06/soap-encoding"
xmlns:m="http://example.org/2001/06/quotes">
<Price>34.5</Price>
</m:GetLastTradePriceResponse></env:Body>
</env:Envelope>
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
46SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
BPEL
Business Process
Execution Language
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
47SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
What is BPEL4WS
BPEL4WS: Business Process Execution Language for Web Services
Provides an XML notation and semantics for specifying business process behavior based on Web Services
In particular, expresses business processes consisting of functions defined through Web services interfaces
Where it comes from: Traditional flow models
Specified on top of WSDL and XML specifications
Merges WFSL and XLANG concepts
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
48SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
BPEL Overview
History of BPEL
BPEL emerged as a convergence of language features from
IBM's Web Service Flow Language (WSFL) and Microsoft's
XLANG
BPEL 1.0 was jointly developed by IBM, BEA, SAP, Siebel, and
Microsoft in August 2002
BPEL 1.1 was submitted to OASIS in April 2003
Currently, it is the process of finalising the standard specification,
namely WS-BPEL 2.0
BPEL Engines
BEA WebLogics, IBM WebSphere, Microsoft BizTalk, SAP XI,
Oracle BPEL Process Manager, and ActiveBPEL
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
49SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
BPEL Structure Overview
<process>
<partners> … </partners>
<variables> … </variables>
<correlationSets> … </correlationSets>
<faultHandler> … <faultHandler>
<compensationHandler> … </compensationHandler>
<eventHandler> … </eventHandler>
(activities)*
</process>
activities = <receive>, <reply>, <invoke>, <assign>, <throw>,<terminate>, <wait>, <empty>, <sequence>, <switch>,<while>, <pick>, <flow>, <scope>, <compensation>
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
50SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
Activities
Basic activities (or primitive activities) correspond to
atomic actions and stand for work being performed
within a process
Structured activities impose behavioural and execution
constraints on a set of activities contained within them
Can be nested and combined in arbitrary ways
Enable the presentation of complex structures
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
51SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
Basic Activities
Invoke: invoking an operation on some Web service
Receive: waiting for a message from an external partner
Reply: replying to an external partner
Wait: pausing for a certain period of time
Assign: copying data from one place to another
Throw : indicating errors in the execution
Compensate: undoing the effects of already completed activities
Exit: terminating the entire service instance
Empty: doing nothing
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
52SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
Structured Activities
sequence: executes one or more activities sequentially
flow: executes one or more activities in parallel
switch: executes one of several paths based on the value of a
condition
pick: block and wait for a suitable message to arrive
while: executes a specified activity as long as a condition is true
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
53SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
BPEL at Work
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
54SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
Elements of a BPEL Process
! ! !
JavaSnippet
Wait
JavaSnippet
Receive
Assign
Assign
Receive
Invoke
Receive
Invoke
Throw
PartnerLinksplaceholders for process callers
and service providers
Variableshold data used in
the business process
FaultHandlersenclose activities
that are performed in cases of error
CorrelationSets
support process instance identification
Activitiessubtasks of the process
Control Linksdefine the process'
control flow
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
55SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
BPELA Simplified Example (1)
<process>
...
<partnerLink name=“customer” ... />
...
<variables>
<variable name = incomingRequest … />
<variable name = customerInfo … />
</variables>
<sequence>
<receive partnerLink="customer"
variable=“incomingRequest“ />
Identifies a
communication partner
Declares variables
Receives a
message
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
56SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
BPELA Simplified Example (2)
<assign>
<copy>
<from variable=“incomingRequest"
property="props:customerNumber"/>
<to variable=“customerInfo"
property="props:customerID"/>
</copy>
</assign>
...
</sequence>
</process>
Performs an assignment
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
57SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
BPEL Structure
BPEL draws upon concepts and constructs from imperative
programming languages
lexically scoped variables, variable assignment, sequential execution,
conditional branching, structured loops, and exception handling (try-
catch blocks)
BPEL extends this basic set of constructs with constructs related to
Web services and business process management
Messaging: send, receive, send/receive
Concurrency: block-structured parallel execution, race conditions,
event-action rules
XML typing: XML Schema, WSDL, XPath, XSLT
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
58SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
Basic Activities for Interactions
Invoke, receive, and reply are three types of interaction actions Invoke/reply “send” action
Receive “receive” action
Invoke: synchronous (“request-response”) vs. asynchronous (“one-way”) operation
Receive: instantiation of a new process instance
Restrictions “conflictingReceive” and “conflictingRequest”
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
59SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
Defining a Graphical Process Notation
The Business Process Modeling Notation (BPMN) aims
at defining a standard graphical notation for defining
process logic
It’s owned by the Object Management Group (OMG)
Receive
Invoice
PO
Found?
Process
POSend
PaymentYes
OK?
Yes
NoNo
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
60SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
Example
<sequence>
<receive name=“startBusProcess” partnerLink=“Buyer”
operation=“request” variable=“request” createInstance=“yes”/>
<flow name=“supplier_flow”>
<invoke name=“quote1” partnerLink=“Supplier1”
operation=“request_quote” inputVariable=“part_request”
outputVariable=“part_quote”/>
<invoke name=“quote2” partnerLink=“Supplier2”………/>
</flow>
<reply name=“respond” partnerLink=“Buyer”
operation=“send_proposal” variable=“proposal”/>
</sequence>
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
61SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
Example
A correlation set contains a set of properties shared by all messages in a correlated group
<invoke partnerLink="Buyer" portType="SP:BuyerPT"
operation="AsyncPurchaseResponse"
inputVariable="POResponse">
<correlations>
<correlation set="PurchaseOrder" initiate="no"
pattern="out">
<correlation set="Invoice" initiate="yes" pattern="out">
</correlations>
</invoke>
<correlationSet name="PurchaseOrder"
properties="cor:customerID cor:orderNumber"/>
<correlationSet name="Invoice"
properties="cor:vendorID cor:invoiceNumber"/>
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
62SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
Structured Activities
Sequence contains activities that are performed sequentially
Switch supports conditional routing between activities case – normal conditional branches
otherwise – default branch
Pick captures race conditions based on timing or external triggers onMessage – message events
onAlarm – alarm events
While supports repeated performance of an activity in a structured loop
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
63SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
Structured Activities
Flow provides parallel execution and synchronization of activities Support the usage of control links for imposing further control
dependencies between activities
Scope is used for grouping activities into blocks, each being treated as a unit to which the same event and exception handling can be applied A primary activity defines its normal behaviour
It can provide event handlers, fault handlers, and compensation handlers
The entire process is seen as the top level scope
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
64SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
BPEL Models
<sequence>
<flow>
<pick>
Serialized <send>,
<receive>,
<invoke>, <…>
parallel <send>,
<receive>, <invoke>,
<…>
Wait for one or more
<receive> or an
alarm condition
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
65SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
BPEL Models
<switch>
<case />
</switch>
While
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
66SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
Control Links
Control links are a non-structural construct defined in BPEL
A control link denotes a conditional transition between two activities
Notions related to control links A transition condition (associated with a control link) is a boolean
expression over the process variables
A join condition (associated with an activity) is a boolean expression in terms of tokens carried by incoming control links to the activity
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
67SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
Compensation
Compensation refers to application-specific activities that
attempt to undo the already completed actions
A compensation handler is defined for a scope, and
specifies the actions need to be taken for the
compensation of the scope
A compensate activity is used to invoke the
compensation of an inner scope, i.e., its occurrence
triggers the compensation handler associated with that
scope
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
68SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
BPEL at Work
salesBP: example of a BPEL process for sales service It interacts with a
customer process (customerBP) via asynchronous messages
salesBP is the service provider
Customer is the service requester
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
69SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
Conclusion
BPEL is being used primarily as a language for implementing Web services using a process-oriented paradigm It is competing with existing enhancements to mainstream
programming environments
BPEL abstract processes can be viewed as adding “behaviour semantics” on top of the basic structural definitions of service interactions provided by WSDL interfaces Tool vendors give little attention to exploring the possibilities
opened by BPEL abstract processes
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
70SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
UDDI
Universal Description,
Discovery and Integration
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
71SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
UDDI
• Universal Description, Discovery and Integration
• Platform-independent, open framework for describing services,
discovering businesses, and integrating business services.
• A layer above SOAP, it is the glue that connects all the SOAP
objects into a Business Web
• DNS like model implementation of the directory
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
72SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
UDDI
UDDI Business Registry
3. UBR assigns a programmatically unique
identifier to each service and business
registration
Service Type
Registrations
Business
Registrations
SW companies, standards
bodies, and programmers
populate the registry with
descriptions of different types
of services
1.
Businesses
populate
the registry with
descriptions of
the services they
support
2.
Business uses this
data to facilitate easier
integration with each
other over the Web
5.
Marketplaces, search
engines, and business apps
query the registry to
discover services at other
companies
4.
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
73SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
UDDI
The Web service provider can register their Web services at these UDDI registries and Web service requester can lookup a specificWeb service by its provider name (business name), category info, Web service name, or even by the keys of them if requester knows.
A Web service provider actually registers a WSDL (web Service Description Language) interface at UDDI registry which is a contract interface of the Web service to be used by its client.
Both UDDI query requests and UDDI query results are in the SOAPformats.
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
74SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
Registry Data
Businesses register public
information
about themselves
Standards bodies,
Programmers, Businesses
register information about
their Service Types
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
75SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
Business name
Text description
List of multi-language text strings
Contact info
Names, phone numbers,
fax numbers, web sites…
Known identifiers
List of identifiers that a business may be known by -
DUNS, Thomas, other
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
76SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
Business categories
3 standard taxonomies in V1
Industry: NAICS (Industry codes - US Govt.)
Product/Services: UN/SPSC (ECMA)
Location: Geographical taxonomy
Implemented as name-value pairs to allow any valid
taxonomy identifier to be attached to the business
white page
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
77SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
New set of information businesses use to
describe how to “do e-commerce” with them
Nested model
Business processes
Service descriptions
Binding information
Programming/platform/
implementation agnostic
Services can also be categorized
Se
rvic
e O
rien
ted
Arc
hite
ctu
re
78SOA Workshop: A. Mahjoorian , Session 4 .... System Co.
UDDI
A Web service provider must publish/register its services with a Universal Description, Discovery, and Integration (UDDI) registry so that it can be accessed by any Web services requester globally.
It just looks like a phonebook where all businesses register their phones there for customers to lookup services. A customer must lookup the phonebook either on-line or by phonebook unless a customer knows the phone number before.
A Web service can also be reached without any assistance from UDDI if the Web service client knows the contact information such as Web service’s URL, name of method, argument signature of the method including types of return value.
79
:تهیه شده توسط
امیر مهجوریان
مدیرفنی آزمایشگاه معماری سازمانی سرویس گرامدیرعامل شرکت دانش بنیان کاریز سیستم پویا