74
Semantic Business Process Management Lectuer 4 Business Process Execution Language Prof. Dr. Adrian Paschke Corporate Semantic Web (AG-CSW) Institute for Computer Science, Freie Universitaet Berlin [email protected] http://www.inf.fu-berlin.de/groups/ag-csw/ Arbeitsgruppe

Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

Semantic Business Process Management

Lectuer 4 – Business Process Execution Language

Prof. Dr. Adrian Paschke

Corporate Semantic Web (AG-CSW)

Institute for Computer Science, Freie Universitaet Berlin

[email protected]

http://www.inf.fu-berlin.de/groups/ag-csw/

Arbeitsgruppe

Page 2: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

Overview

Motivation BPEL

Basic Concepts

Data Handling

Structured Activities

State Management

Exceptions, Compensations, Event-handling

Auxiliary Activities

Summary

Page 3: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

WS-Stack und -Standards

Description

HTTP, IIOP, JMS, SMTP Transport

XMLMessaging

SOAP

WSDL

UDDI Discovery

Transactions

CoordinationWS-SecurityWS-ReliabilityQuality of

Service

Orchestration

WS-BPELBusiness

Processes

Context

Description

Managem

ent

Choreography

WS-CDL

Page 4: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

WS-BPEL XML-based language for the specification of business processes with several web

services.

Evolved from Microsofts„ XLANG (graph based) and IBMs WS-FL (algebraic).

Current version WS-BPEL Version 2.0 – Standardized draft by OASIS (Organization for the Advancement of Structured Information Standards).

Predecessor BPEL4WS 1.1 (2003) by BEA, IBM, Microsoft, SAP, Siebel

Similar to higher imperative programming languages (if, while,..).

BPEL is based on XML Schema, XPath and WSDL.

Recursive composition : BPEL process is itself a WS (WSDL with PortTypes, Operations, …)

Page 5: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

History – WS-Orchestration

2000/05

XLang(Microsoft)

2001/03

BPML(Intallio et al)

2001/05

WSFL(IBM)

2001/06

BPSS(ebXML)

2002/03

BPEL4WS 1.0

(IBM, Microsoft)

BPEL4WS 1.1(OASIS)

WS-BPEL 2.0(started 2005)

2002/06 2003/01

WS-Choreography(W3C)

2003/04

WSCI(Sun etc.)

WSCL(HP)

2002/08

Page 6: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

WS-BPEL

Page 7: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

Process Example: Price Procurement

from

devx.com

Page 8: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

WS-Orchestration with BPEL

S

e

r

vi

c

e

s

<process>

<sequence>

<receive

… />

<invoke

… />

</sequence>

</process>

Design Tool

BPEL

Process

Orchestration Server (BPEL Engine)

Process Designer

Publish

.NET

Java

Siebel

Page 9: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

Orchestration vs. Choreography

WS-OrchestrationAn executable business

process under the control

of a central entity

WS-Choreography

describes rules for the interchange of

messages between entities, no central

control entity

Entities need to know, in which process

they will be embedded

WS-BPEL (OASIS),

Control entity: (BPEL Engine)WS-CDL (W3C Draft),

Choreography Description Language

Page 10: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

BPEL Basic Concepts

Page 11: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

BPEL Syntax

<process>

<partnerLinks> … </partnerLinks>

<variables> … </variables>

<correlationSets> … </correlationSets>

<faultHandlers> … <faultHandlers>

<compensationHandler> … </compensationHandler>

<eventHandlers> … </eventHandlers>

(activities)*

</process>

activities = <receive>, <reply>, <invoke>, <assign>, <throw>,

<terminate>, <wait>, <empty>, <sequence>, <switch>,

<while>, <pick>, <flow>, <scope>, <compensate>

Session- and/or

Transaction-IDs

Rollback - Code for

tacking back actionsMain Process flow

description

Prozess state,

Data interchange between

process and partner WS

Partner

communication - WS

with which the

process interacts

Exception

Handling

Code for handling events

Document-root (Container

for BPEL Script)

Page 12: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

BPEL Syntax

<process>

<partnerLinks> … </partnerLinks>

<variables> … </variables>

<correlationSets> … </correlationSets>

<faultHandlers> … <faultHandlers>

<compensationHandler> … </compensationHandler>

<eventHandlers> … </eventHandlers>

(activities)*

</process>

activities = <receive>, <reply>, <invoke>, <assign>, <throw>,

<terminate>, <wait>, <empty>, <sequence>, <switch>,

<while>, <pick>, <flow>, <scope>, <compensate>

Session- and/or

Transaction-IDs

Rollback - Code for

tacking back actionsMain Process flow

description

Prozess state,

Data interchange between

process and partner WS

Partner

communciation - WS

with which the

process interacts

Exception

Handling

Code for handling events

Document-root (Container

for BPEL Script)

Page 13: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

Partner Links (I) PartnerLink-Types (defined in WSDL)

<partnerLinkType

name="BuyerSellerLink">

<role name="Buyer">

<portType name="BuyerPT"/>

</role>

<role name="Seller">

<portType name="SellerPT"/>

</role>

</partnerLinkType>

PartnerLinks (defined in BPEL)

<partnerLinks>

<partnerLink

name="buying"

partnerLinkType="BuyerSellerLink"

myRole="Buyer"

partnerRole="Seller"/>

</partnerLinks>

Buyer(BuyerPT)

BuyerSellerLink

Seller

buying

Buyer

Process Remote

service

Seller(SellerPT)

Partner (BPEL Process and external WS)

provide message channels (defined in WSDL:

PortTypes, Operations)

Page 14: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

WSDL with PartnerLinkTypes as Extensibility Elements<?xml version="1.0" encoding="UTF-8"?>

<definitions … >

<types>…</types>

<message …</message> …

<portType name=buyerPT„> … </portType> …

<binding > …</binding> …

<service > … </service> …

<partnerLinkType name=„BuyerSellerLink">

<role name=„Buyer“ portType=„buyerPT"/>

<role name=“…" portType=“…"/> <!– Import Partner WSDL -->

</partnerLinkType>

</definitions>

concrete binding: binding, service – port not part of BPEL -> BPEL Engine

needs to process infos from WSDL files

Page 15: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

BPEL Syntax

<process>

<partnerLinks> … </partnerLinks>

<variables> … </variables>

<correlationSets> … </correlationSets>

<faultHandlers> … <faultHandlers>

<compensationHandler> … </compensationHandler>

<eventHandlers> … </eventHandlers>

(activities)*

</process>

activities = <receive>, <reply>, <invoke>, <assign>, <throw>,

<terminate>, <wait>, <empty>, <sequence>, <switch>,

<while>, <pick>, <flow>, <scope>, <compensate>

Session- and/or

Transaction-IDs

Rollback - Code for

tacking back actionsMain Process flow

description

Prozess state,

Data interchange between

process and partner WS

Partner

communication - WS

with which the

process interacts

Exception

Handling

Code for handling events

Document-root (Container

for BPEL Script)

Page 16: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

Activities for the Interaction with Partners

<receive …/> Process receives a call on an provided operation from a partner

(block, process waits for call)

<reply …/> Process sends reply message to the requesting partner

(synchronized communication)

<invoke …/> Process calls an operation from a partner WS

Page 17: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

<receive> ... <reply> Simple Synchronous BPEL Process

Source: http://www-128.ibm.com/developerworks/webservices/library/ws-bpelcol2/

1. Call processes (WS) from client partner

2. Accept the SOAP message

<receivepartnerLink="b” portType="SellerPT" operation=“sell" variable=“var_received“createInstance="yes"/>

Saves received message:

correspons with received message

type (WSDL)

Starts an instance of the BPEL

processes (BPEL scripts are

executed)

3-5. Call a partner WS with <invoke>

6. Send reply to client with <reply>

<reply

partnerLink="selling" portType="SellerPT" operation=“sell" variable=“var_reply"/>

like

<receive>

Reply message for the client; corresponds with

output message type of the opreation „sell“

(WSDL)

Optional ( redundant)

Page 18: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

<invoke>

Synchronized call of an external Partner-WS via invoke

<invokepartnerLink="buying" portType="SellerPT" operation="buy" inputVariable=“var_send" outputVariable=“var_receive"/>

Ext. WS(SellerPT)

buy(itemid)

Prozess(BuyerPT)

buying

response

Variables correspond to WSDL

message types; are explicitly

declared

Contains the result

Page 19: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

Messages and Variable

<message name=„buyingInformationMessage">

<part name=„customerID" type="xsd:string"/>

<part name=„productID" type="xsd:Integer"/>

<part name="amount" type="xsd:integer"/>

</message>

...

<variable name=”var_send”

messageType=”buyingInformationMessage”/>

... value assignment to var_send ...

<invoke

partnerLink="buying"

portType="SellerPT"

operation="buy"

inputVariable=“var_send"

outputVariable=“var_receive"/> BPEL

WSDL

Page 20: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

Synchronous vs. Asynchronous BPEL processes Synchronous BPEL Processes: Reply direclty within the same TCP-

connection (Client is blocked and waits…).

WSDL interface of the processes (external: Operation): Request-Response type

<process> …

<receive …> <!– Initiierend --> . .... do processing .....

<reply …>

</process>

Asynchronous Processes: No reply or within a new connection – call a call back method of the clients (client does not wait)

WSDL interface of the processes: Request-only! Type

<process> …

<receive …> <!– Initiierend --> ....... Perform time-consuming processing .....

<invoke …> …

</process>

?

Page 21: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

Synchronous vs. asynchronous request on external services

Synchronous communication

Operation of type Request-Response

Defintion of inputVariable and outputVariable !

Process provides no PortType, only the requested WS

Unidirectional partner link, only PartnerRole

Asynchronous communication

Two roles & & PortTypes are needed

PortType of the partners offering WS -> PartnerRole

PortType of the prozesses receiving Call-Backs -> MyRole

<partnerLinkType name=„bidirectionalLT"> <role name=„provider"> <portType name=„servicePT" /> </role> <role name=„consumer"> <portType name="CallbackPT" /> </role>

</partnerLinkType>

<partnerLinkType name=„unidirectionalLT">

<role name=„provider"> <portType name=„servicePT"/> </role>

</partnerLinkType>

Page 22: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

Data Handling

Page 23: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

BPEL Syntax

<process>

<partnerLinks> … </partnerLinks>

<variables> … </variables>

<correlationSets> … </correlationSets>

<faultHandlers> … <faultHandlers>

<compensationHandler> … </compensationHandler>

<eventHandlers> … </eventHandlers>

(activities)*

</process>

activities = <receive>, <reply>, <invoke>, <assign>, <throw>,

<terminate>, <wait>, <empty>, <sequence>, <switch>,

<while>, <pick>, <flow>, <scope>, <compensate>

Session- and/or

Transaction-IDs

Rollback - Code for

tacking back actionsMain Process flow

description

Prozess state,

Data interchange between

process and partner WS

Partner

communication - WS

with which the

process interacts

Exception

Handling

Code for handling events

Document-root (Container

for BPEL Script)

Page 24: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

Data Handling - Variables

BPEL variable types are WSDL message types,

XML simple types or a

XML schema element.

<variables>

<variable name=“address“ messageType=“…"/>

<variable name="itemid“ type="xsd:int"/>

<variable name=“name“ element=“…"/>

…</variables>

Page 25: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

Variables – value assignment (I)

Assignment with <assign> Sources are Variable contents, XPath expressions or literales.

Strong static type safety.

<assign><copy>

<from>1000</from><to variable="maxprice“/>

</copy>

<copy><from variable=“itemID”/><to variable=“ibis_request“ part=“itemIDPart”>

</copy>

<copy>

<from>$HelloOperationOut.parameters/return</from>

<to variable="OperationOut" part="main“

query=“/rueck/return</to>

</copy>

</assign>

Literal

Variable content

Message Type, attribute “part”,

XPATH 1.0 Expression: part as a combined type

Page 26: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

Implicit value assignemnt with Receive<message name="creditInformationMessage">

<part name="firstName" type="xsd:string"/>

<part name="lastName" type="xsd:string"/>

<part name="amount" type="xsd:integer"/>

</message>

<variable name=”requestLoan” messageType=”creditInformationMessage”/>

...

<receive partnerLink="loanRequester" portType="loanProcess" operation="processLoanRequest" variable=”requestLoan”/>

WSDL

BPEL

The variable contrains the results of a request

Page 27: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

Structured Activities

Page 28: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

Structured Activities

Sequence Activities are executed in a sequential order

while Defines cyclic behavior

switch alternative selection, based on the evaluation of an expression

pick Event based, alternative selection, executes the first received

occurrence

flow Parallel activity

Page 29: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

<sequence> Sequentiell execution

<sequence>

<invoke ../>

<receive../>

<invoke ../>

</sequence>

invoke

receive

invoke

Page 30: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

<while>

As long as the condition is satisfied, do…

<while condition= "getVariableData('counter') > 12">

<!– some activities -->

</while>

The BPEL function getVariableData takes a variable as

argument… as well as optional a part of it and a XPath expression

(Message Type)

getVariableData(„variableName„ „main‟ ‟/counter‟)

Page 31: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

<switch> Multiple case differentiation – only executes the branches with fulfilled

conditions.

Otherwise will be executed, if no other branch is selected (like “default” in Java)

<switch>

<case condition = "getVariableData(account) > 1000">

<reply partnerLink=“customer" operation=“helloIHaveMoney“variable=“MoneyPlus"/>

</case>

<case …

</case>

<otherwise>

<reply partnerLink=“customer" operation=“helloIHaveMoney“variable=“MoneyMinus"/>

</otherwise>

</switch>

Page 32: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

<pick>

Event-based distinction: execute the first event occurence

<pick>

<onMessage partnerLink=”” portType=”” operation=””>

<!– some activities>

</onMessage>

<onMessage partnerLink=”” portType=”” operation=””>

<!– some activities>

</onMessage>

<pick>

Page 33: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

Parallel Execution <flow>

Executed all child activities of <flow> in parallel

… and then wait, till all child are finished

<flow>

<invoke partnerLink="Lufthansa" operation=“getCheapestFlight" … />

<invoke partnerLink="Hapag Lloyd" operation=" getCheapestFlight " … />

<invoke partnerLink="BBA" operation=" getCheapestFlight " … />

<invoke partnerLink="Air Berlin" operation=" getCheapestFlight " … />

</flow>

Page 34: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

<links> - dependencies within <flow>

<links> - modelling of dependencies between activities of a flow (directed graph).

<flow>

<links><link name=“firstBookFlightThenRentCar">

</links>

<!-- operation bookFlight --><invoke partnerLink="Lufthansa" operation=“bookFlight“ ..>

<source linkName="firstBookFlightThenRentCar“

transitionCondition=“getVariableData('var_receive‟ „main‟ ‟booking_state‟)=„true‟"/>

</invoke>

<!-- operation rentCar --><invoke partnerLink="Rent-A-Car" operation=“rentCar" ..>

<target linkName="firstBookFlightThenRentCar"/></invoke>

</flow>

outputVariable

Page 35: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

State managment

Correlation Sets

Page 36: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

BPEL Syntax

<process>

<partnerLinks> … </partnerLinks>

<variables> … </variables>

<correlationSets> … </correlationSets>

<faultHandlers> … <faultHandlers>

<compensationHandler> … </compensationHandler>

<eventHandlers> … </eventHandlers>

(activities)*

</process>

activities = <receive>, <reply>, <invoke>, <assign>, <throw>,

<terminate>, <wait>, <empty>, <sequence>, <switch>,

<while>, <pick>, <flow>, <scope>, <compensate>

Session- and/or

Transaction-IDs

Rollback - Code for

tacking back actionsMain Process flow

description

Prozess state,

Data interchange between

process and partner WS

Partner

communication - WS

with which the

process interacts

Exception

Handling

Code for handling events

Document-root (Container

for BPEL Script)

Page 37: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

Motivation: State management via Correlation Sets

Source: http://developer.capeclear.com

Need for processes with several (blocking)

<receive> activities

Simple Example., process with two synchronous operations: setValue and getValue

setValue set a value, which will be retrieve by getValue

setValue starts a new process instance

In case of several „waiting“ instances: which instance should be assigned to the getValueoperations call? (new TCP conn.)

Solution: transfer unique identifier in the instance of a message (like cookies with Session-IDs)

Page 38: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

Correlation Sets - Process Instance Routing

Different parties (bank, transport service, etc.) create transaction IDs.

BPEL: A correlationSet identifies uniquely the interaction of the process instance with a partner AccountID of the bank + account number of the customer

OrderID of the supplier

Session-ID

etc.

A correlationSet consists of at least on property

Properties are transported in a SOAP message

If the property values are equal with the values of the correlationSet of a process instance then the request will be assigned to the process instance by the BPEL-Engine

Otherwise the message will be ignored

Page 39: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

Correlation Sets and Properties Define appropriate Property Elements , which uniquely assigns the message to a

process instance

<property name=“identifier" type="xsd:string"/>

Then PropertyAlias elements define an alias per request message, which show where the message can be found(Spezification of message type, part, XPath query).

<propertyAlias propertyName="identifier“messageType="setValueRequestMessage“

part="request“ query="/SetValue/Identifier"/>

<propertyAlias messageType="getValueRequestMessage“ part="request"

propertyName="identifier“ query="/GetValue/Identifier"/>

Define correlation sets (sets of properties)

<correlationSets>

<correlationSet name="instanceID“ properties="identifier" />

</correlationSets>

WSDL

WSDL

BPEL

Page 40: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

<property name=“identifier" type="xsd:string"/>

<propertyAlias propertyName="identifier“ messageType="setValueRequestMessge

part="request“ query="/SetValue/Identifier"/>

<propertyAlias propertyName="identifier“ messageType="getValueRequestMessage“

<correlationSets>

<correlationSet name="instanceID“ properties="identifier" />

</bpws:correlationSets>

<receive partnerLink="client" operation="setValue" portType=“…“

createInstance="yes" variable="setValueRequestMessage">

<correlations> <correlation set="instanceID" initiate="yes/> </correlations>

</receive>

<receive partnerLink="client" portType="ns:Correlation"

operation="getValue" variable="getValueRequestMessage>

<correlations> <correlation set="instanceID" /></correlations>

</receive>

Example.: BPEL Message Correlation

WSDL

BPEL

Set property-values

(via Alias)

Compare property alias

values with property

values

Page 41: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

Execptions, Compensations, Event-handling

Page 42: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

BPEL Syntax

<process>

<partnerLinks> … </partnerLinks>

<variables> … </variables>

<correlationSets> … </correlationSets>

<faultHandlers> … <faultHandlers>

<compensationHandler> … </compensationHandler>

<eventHandlers> … </eventHandlers>

(activities)*

</process>

activities = <receive>, <reply>, <invoke>, <assign>, <throw>,

<terminate>, <wait>, <empty>, <sequence>, <switch>,

<while>, <pick>, <flow>, <scope>, <compensate>

Session- and/or

Transaction-IDs

Rollback - Code for

tacking back actionsMain Process flow

description

Prozess state,

Data interchange between

process and partner WS

Partner

communciation - WS

with which the

process interacts

Exception

Handling

Code for handling events

Document-root (Container

for BPEL Script)

Page 43: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

Throw-Catch – Execption Handling (I) Several ways to handle faults (BPEL Exceptions)

WSDL Fault Message as reply to synchronous WS call

Automated failure signaling of the BPEL RE: wrong configuration, network communication error, etc.

Internal, explicit failure signaling with throw activity:

<throw faultName="NoDatabaseConnectionFault"/>

Not handled failure -> stop process, are not automatically forwarded to the client

faultHandlers: except if they are captured by Fault Handler; Fault Handler handles failure, by defining flows for specific failures

<faultHandlers><catch faultName="NoDatabaseConnectionFault">

<!-- Some Fault handling activities -->

</faultHandlers>

Page 44: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

Throw Example<!-- Check if the credit card is accepted -->

<switch>

<case condition="getVariableData('BookResponse', 'confirmation', '/confirmation/accepted')='true'">

<!-- Make a callback to the client -->

<invoke partnerLink="Client„portType="buy:ClientCallbackPT„operation="ClientCallback„inputVariable="BookResponse" />

</case>

<otherwise> <!-- Throw fault -->

<throw faultName="CreditCardNotAccepted"/>

</otherwise>

</switch>

Page 45: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

Catch Example<process ...>

<partnerLinks> ... </partnerLinks><variables> ... </variables><faultHandlers>

<catch faultName="CreditCardNotAccepted" ><!-- First fault handler; makes a callback to the client -->

<invoke partnerLink="Client" portType="buy:ClientCallbackPT„operation="ClientCallbackFault" inputVariable="Fault"/>

</catch>

<catch ... ><!-- Perform an activity -->

</catch>...<catchAll> <!-- optional -->

<!-- Perform an activity --></catchAll>

</faultHandlers>

<sequence> ... </sequence>

</process>

Copy failure info in the variable „Fault“ of Fault-

Message-Types

<assign><copy><from expression="string(‘Credit

Card Not Accepted')" /><to variable="Fault" part="error" />

</copy></assign>

Page 46: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

Scopes and Fault Handling I

Scopes split complex processes into several contexts (sub processes)

Scopes can be defined sequentially or nested (hierarchically) -outermost scope:= <process>

Scopes allow defining different fault handler for different groups of activities (e.g. <sequence> or <flow>).

Additionally local variables can be defined in scopes, which are not visible outside of the scopes (but in sub scopes!)

Scopes allow additional definition of own Correlation Sets, Event Handler, etc.

Not handled faults within a scope -> forward to super scope… until <process>

Page 47: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

Scopes and Faults Handling II<scope name=„Subprocess“> …

<!– some outer scope activities -->

<scope name=„SubSubProcess“>

<variables> <!-- Variables local to scope --> </variables>

<correlationSets> <!-- local Correlation sets --> </correlationSets>

<faultHandlers> <!-- local Fault handlers --> </faultHandlers>

<compensationHandler> <!-- local --> </compensationHandler>

<eventHandlers> <!– local --> </eventHandlers>

<!-- activities, e.g. <sequence> or <flow> -->

</scope>

<!– some outer scope activities, e.g. <sequence> or <flow> -->

</scope>

Global Fault Handler allow controlled reaction on faults

But: Process jumps into failure handling routine and terminates

Scoped faultHandler: Local fault handing, process might continue … or, if no further process execution is possible

Rollback: call compensationHandlers of already executed scopes -> roll-back their activities -> consistence

Page 48: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

Sequence with three Scopes and Fault in the third scope.

Transaction Control: Rollback

Scope 1 Scope 2 Scope 3

Handle new

failures

Eventually backtrack

previous (successful)

activities

compensationHandler faultHandler

Page 49: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

BPEL Syntax

<process>

<partnerLinks> … </partnerLinks>

<variables> … </variables>

<correlationSets> … </correlationSets>

<faultHandlers> … <faultHandlers>

<compensationHandler> … </compensationHandler>

<eventHandlers> … </eventHandlers>

(activities)*

</process>

activities = <receive>, <reply>, <invoke>, <assign>, <throw>,

<terminate>, <wait>, <empty>, <sequence>, <switch>,

<while>, <pick>, <flow>, <scope>, <compensate>

Session- and/or

Transaction-IDs

Rollback - Code for

tacking back actionsMain Process flow

description

Prozess state,

Data interchange between

process and partner WS

Partner

communication - WS

with which the

process interacts

Exception

Handling

Code for handling events

Document-root (Container

for BPEL Script)

Page 50: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

Compensation Handling

Compensation of Effects.

<compensate scope="ScopeName“/>

Are handled by compensationHandler

<scope name=“ScopeName”>

<compensationHandler>

<invoke partnerLink="bidding" portType="AuctionPT"operation="undoBid" inputVariable="productID"> <correlations><correlation set="visitorID" initiate="no“ …/>

</correlations></invoke>

</compensationHandler>

Page 51: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

BPEL Syntax

<process>

<partnerLinks> … </partnerLinks>

<variables> … </variables>

<correlationSets> … </correlationSets>

<faultHandlers> … <faultHandlers>

<compensationHandler> … </compensationHandler>

<eventHandlers> … </eventHandlers>

(activities)*

</process>

activities = <receive>, <reply>, <invoke>, <assign>, <throw>,

<terminate>, <wait>, <empty>, <sequence>, <switch>,

<while>, <pick>, <flow>, <scope>, <compensate>

Session- and/or

Transaction-IDs

Rollback - Code for

tacking back actionsMain Process flow

description

Prozess state,

Data interchange between

process and partner WS

Partner

communciation - WS

with which the

process interacts

Exception

Handling

Code for handling events

Document-root (Container

for BPEL Script)

Page 52: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

Events

Leave the primary process path

In case of faults (Fault Handler)

In case of particular event occurences (Events)

BPEL has two types of events:

<onMessage> - Message-Events

Triggered by a received message, i.e. operation call

<onMessage> syntax like <receive>, has the same attributes

<onAlarm> - time-based alarm events

(date, time, duration from XML Schema, ISO 8601)

After a time interval (for attribute)e.g.:<onAlarm for 'P1M3DT4H10M„> <!– P=Period of… -->

At a certain time point (until attribute) e.g..:<onAlarm until '2007-03-18T21:00:00+01:00„>

Page 53: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

Pick Activity - Events<pick>

<onMessage partnerLink="name"portType="name"operation="name" variable="name">

<!-- Perform an activity or a set of activities enclosed by <sequence>, <flow>, etc. or throw a fault -->

</onMessage>

<onMessage ...><!-- Perform an activity -->

</onMessage>

...

<onAlarm ...><!-- Perform an activity -->

</onAlarm>

<onAlarm for="'PT15M'"> <!–- Nachrichtenlos für 15 Minuten --><throw faultName="Timeout"/>

</onAlarm>

...

</pick>

Page 54: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

Event Handler <pick>, if a process should wait on an event

If process should be continued normally, without waiting on the events, but should handle occurred events -> Event Handler

Typical example: incoming „cancellation message„ of a client for a certain transaction (e.g. travel booking)

Event Handler for a complete process or specific scopes

<process ...>

<partnerLinks> ... </partnerLinks>

<variables> ... </variables>

<faultHandlers> ... </faultHandlers>

<compensationHandler> ... </compensationHandler>

<eventHandlers>

<onMessage ...> <!-- Perform an activity --> </onMessage>

<onAlarm for="'PT15M'"> <throw faultName="Timeout" /> …</onAlarm>

</eventHandlers>

<!-- activities -->

</process>

Page 55: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

Additionally…

Page 56: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

Auxiliary Activity <empty/> <empty/> activity…does nothing

Some constructs require at least one activity

Example:

<pick>

<onMessage partnerLink="JamesBond"

operation="deaktivieren„ … >

<empty/>

</onMessage>

<onAlarm for="'PT30S'">

<invoke partnerLink="Bombe"

operation="explodiere„ … />

</onAlarm>

</pick>

Page 57: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

Auxiliary Activity <terminate/>

<terminate/> terminates the process

Example:

<pick>

<onMessage partnerLink="Kunde„operation="bestätigen">

<reply partnerLink="Kunde" operation="bestätigen„

variable="true"/>

</onMessage>

<onAlarm for="'P30D'"> <terminate/> </onAlarm>

</pick>

Page 58: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

Auxiliary Activity <wait/>

<wait/> wait for a certain time span or till a

fixed time point

Examples:

<wait for="'PT30M'"/>

<wait until="'2007-12 14T09:45+01:00'"

/>

Page 59: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

Activity <if> <if> - simple case distinction

<if >

<condition> ( $userdata.password = $inputVar.inputType/paramA )

</condition>

<!– some activities -->

<else>

<!– some activities -->

</else>

</if>

Page 60: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

BPMN to BPEL Mapping

Page 61: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

Callenges BPMN and BPELWS Mapping

BPELWS is a block structured language and BPMN is a graph language – BPELWS is less expressive than BPMN

BPMN meta-model contains all objects and properties to generate deploy-ready BPELWS (with the exception of correlation set)

You can always generate a BPMN model from a valid BPEL.

Generating a BPEL from a valid BPMN model sometimes is not possible e.g. Discriminator Pattern

Page 62: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

Example BPMN – BPEL Mapping

Page 63: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

Example BPMN – BPEL Mapping

Page 64: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

Example BPMN – BPEL Mapping

Page 65: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

Example BPMN – BPEL Mapping

Page 66: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

BPEL / BPMN Mapping

BPELProcess

namespaces

targetNamespaces

suppressJoinFailure

partnerLinks

Variables

variable

messageType

Type/ElementType

FaultHandlers

catch/catchAll

EventHandlers

OnMessage/OnAlarm

CompensationHandler

Activity

BPMNDiagram

namespaces

Process

targetNamespaces

suppressJoinFailure

Message

Property

BoundaryEvent

Intermediate Event

BoundaryEvent

Task

Page 67: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

BPEL / BPMN Mapping (2)

BPELActivity

Receive

Reply

Invoke

Throw

faultName

Wait

Sequence

Activity

Switch

While

Pick

Flow

Activity

Scope

FaultHandlers

Catch/catchAll

EventHandlers

OnMessage/OnAlarm

Variables

variable

MessageType

Type/ElementType

Compensate

BPMN

StartEvent/Task

EndEvent

Task

EndEvent

errorCode

IntermediateEvent

Task

Gateway

Subprocess

GateWay

GateWay

Task

Subprocess

BoundaryEvent

Intermediate Event

Message

Property

EndEvent

Page 68: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

Summary

Page 69: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

Overview on BPEL language constructs

( <if> )

Page 70: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

Summary BPEL Abstract communication with Web Services

Defined via process-wide „Partner Links“

PartnerLinks refer to associated WSDL description

BPEL runtime environment (BPEL-Engine) is a Web Service Server and Web Service Client

Constructs for control flow and execution (like in higher programming languages)

Persistent process variables

Fault handling and compensation language constructs

Supports parallel and event-based execution

Page 71: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

BPEL Engines

Apache jBPM 4.0

Microsoft: BizTalk Server

IBM WebSphere

Oracle AS

BEA WebLogic

SUN Application Server

Collaxa

webMethods

Active Endpoint‟s activeBPEL

Page 72: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

Processdesigner – Netbeans 5.5

Page 73: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

Collaxa BPEL Designer

Daneben: activeBPEL, Oracle JDeveloper, …

Page 74: Semantic Business Process Management Lectuer 4 Business ...€¦ · Semantic Business Process Management ... Microsoft, SAP, Siebel Similar to higher imperative programming languages

Questions and Literature Questions?

Books: Chapter about BPEL „Web Services Platform Architectures“, S. Weerawarana et al.

„Service-orientierte Architekturen mit Web Services“, Dostal et al.

Informationen im WWW WS-BPEL 2.0 Specification Draft (OASIS)

http://docs.oasis-open.org/wsbpel/2.0/wsbpel-specification-draft.htmlArtikel

Tutorials and Examples Sun Developer Network: Business Process Execution Language

http://developers.sun.com/prodtech/javatools/jsenterprise/nb_enterprise_pack \/reference/techart/bpel.html

Oracle: A Hands-on Introduction to BPEL1+2http://www.oracle.com/technology/pub/articles/matjaz_bpel1.html

Oracle: BPEL Tutorialhttp://www.oracle.com/technology/products/ias/bpel/pdf

IBM: Business Process with BPEL4WShttp://www-128.ibm.com/developerworks/webservices/library/ws-bpelcol1/

Capecear: BPEL Webhelp-Pageshttp://developer.capeclear.com/files/WebHelp

Free Modeling Tools and BPEL-Engines Apache jBPM 4.0

Active Endpoint: activeBPEL 3.0 - http://www.active-endpoints.com/

Sun: Netbeans incl. SOA Pack und AppServer- http://netbeans.org