Prezentare sustinuta in cadrul Cercului de cercetare BPM Facultatea

Transcription

Prezentare sustinuta in cadrul Cercului de cercetare BPM Facultatea
Vasile Alaiba <[email protected]>
Prezentare sustinuta in cadrul Cercului de cercetare BPM
Facultatea de Informatica, Univ. “Al.I.Cuza” Iasi
http://profs.info.uaic.ro/~alaiba/cercbpm
Web Services Business Process
Execution Language Version 2.0,
OASIS Standard, April 2007
M.B. Juric, Business Process Execution
Language for Web Services, Second
Edition, Packt Publishing, 2006
BPEL uses an XML-based vocabulary that
allows us to specify and describe business
processes.
Executable business processes
◦ specify the exact details of business processes
and can be executed by a BPEL engine.
Abstract business processes
◦ specify only the public message exchange
between parties, without including the specific
details of process flows
A BPEL process and its relation to web services
BPEL introduces WSDL extensions, which
enable us to accurately specify relations
between several web services in the
business process.
Business processes compose a set of existing
services
When we describe a business process in BPEL,
we actually define a new web service that is a
composition of existing services.
Activities
◦ A BPEL process consists of steps. Each step is called an
activity.
◦ BPEL supports basic and structured activities.
◦ Basic:
invoking other web services, receiving a request, generating
a response, manipulating data variables, indicating faults
and exceptions, waiting or terminating
◦ Structured:
(ordered) sequence, flow (parallel execution), case-switch
(branching), while (loops), pick (select one of a number of
alternate paths)
Partner links
Variables
<process name="Travel"
targetNamespace="http://packtpub.com/bpel/travel/"
xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
xmlns:trv="http://packtpub.com/bpel/travel/"
xmlns:emp="http://packtpub.com/service/employee/"
xmlns:aln="http://packtpub.com/service/airline/" >
<partnerLinks>
<partnerLink name="client"
partnerLinkType="trv:travelLT"
myRole="travelService"/>
<partnerLink name="employeeTravelStatus"
partnerLinkType="emp:employeeLT"
partnerRole="employeeTravelStatusService"/>
<partnerLink name="AmericanAirlines"
partnerLinkType="aln:flightLT"
myRole="airlineCustomer"
partnerRole="airlineService"/>
<partnerLink name="DeltaAirlines"
partnerLinkType="aln:flightLT"
myRole="airlineCustomer"
partnerRole="airlineService"/>
</partnerLinks>
Links to all parties BPEL interacts with are
called partner links.
Partner links
◦ web services that are invoked by the BPEL process,
also called invoked partner links
◦ links to clients, and can invoke the BPEL process,
also called client partner links
Note that each BPEL process has at least one
client partner link, because there has to be a
client that first invokes the BPEL process.
A partner link type declares how two parties
interact and what each party offers.
<partnerLinkType name="insuranceLT"
xmlns="http://schemas.xmlsoap.org/ws/2003/05/partner-link/">
<role name="insuranceService">
<portType name="ins:ComputeInsurancePremiumPT"/>
</role>
<role name="insuranceRequester">
<portType name="com:ComputeInsurancePremiumCallbackPT"/>
</role>
</partnerLinkType>
...
<portType name="ComputeInsurancePremiumPT">
<operation name="...">
<input message="..." />
</operation>
</portType>
<process ...>
...
<sequence>
<!-- Wait for the incoming request to start the
process -->
<receive ... />
<!-- Invoke a set of related web services, one by
one -->
<invoke ... />
<invoke ... />
<invoke ... />
...
</sequence>
</process>
Sequentially Invoking Web Services
A BPEL process definition is written as an
XML document using the <process> root
element. Web services are invoked
sequentially using <invoke> in a
<sequence> element.
<process ...>
...
<sequence>
<!-- Wait for the incoming request to start the process -->
<receive ... />
<!-- Invoke a set of related web services, concurrently -->
<flow>
<invoke ... />
<invoke ... />
<invoke ... />
</flow>
...
</sequence>
</process>
Concurrently Invoking Web Services
Web services are invoked concurrently
using <invoke> in a <flow> element.
<process ...>
...
<sequence>
<!-- Wait for the incoming request to start the process -->
<receive ... />
<!-- Invoke two sequences concurrently -->
<flow>
<!-- The three invokes below execute sequentially -->
<sequence>
<invoke ... />
<invoke ... />
<invoke ... />
</sequence>
<!-- The two invokes below execute sequentially -->
<sequence>
<invoke ... />
<invoke ... />
</sequence>
</flow>
...
</sequence>
</process>
Nested invocations
<sequence> and <flow> can be nested.
A process usually begins with a
<receive>, waiting for a message to
start.
Synchronous request/reply
<!-- Synchronously invoke the Employee Travel Status Web Service -->
<invoke partnerLink="employeeTravelStatus"
portType="emp:EmployeeTravelStatusPT"
operation="EmployeeTravelStatus"
inputVariable="EmployeeTravelStatusRequest"
outputVariable="EmployeeTravelStatusResponse" />
<!-- Invoke an asynchronous operation -->
<invoke ... />
<!-- Do something else... -->
<!-- Wait for the callback -->
<receive ... />
Variables are used:
◦ to store messages that are exchanged between
business process partners
◦ to hold data that relates to the state of the process
Each variable has to be declared before it can
be used.
To specify type use one of the following
attributes:
◦ • messageType: a WSDL message
◦ • element: an XML Schema element
◦ • type: an XML Schema simple type
<variables>
<variable name="InsuranceRequest"
messageType="ins:InsuranceRequestMessage"/>
<variable name="PartialInsuranceDescription"
element="ins:InsuranceDescription"/>
<variable name="LastName"
type="xs:string"/>
</variables>
<assign>
<copy>
<from variable="InsuredPersonRequest"
part="insuredPersonData" />
<to variable="InsuranceRequest"
part="insuredPersonData“
query="/insuredPersonData/ins:LastName"/>
</copy>
</assign>
<assign>
<copy>
<from expression="string('Juric')" />
<to variable="LastName"/>
</copy>
</assign>
1.
2.
3.
4.
Let us consider the business travel process.
The client invokes the business process, specifying
the name of the employee, the destination, the
departure date, and the return date.
The BPEL business process first checks the
employee travel status. We will suppose that a web
service exists through which such a check can be
made.
Then the BPEL process will check the price for the
flight ticket with two airlines: American Airlines and
Delta Airlines. Again we will suppose that both
airline companies provide a web service through
which such check can be made.
Finally, the BPEL process will select the lower price
and return the travel plan to the client.
How can a BPEL process be designed?
◦ Oracle BPEL Designer (Jdeveloper)
◦ Eclipse BPEL Editor
◦ others (to be identified)
How can a BPEL process be executed?
◦
◦
◦
◦
Oracle BPEL Manager
Microsoft BizTalk
Eclipse BPEL to Java translation
others (to be identified)