BPEL Business Process Execution Language Michal Havey: Essential Business Process Modeling Chapter 5 1
BPEL process definition In XML Book describe version 1 Consist of two type of files BPEL files including main activities, partner links, correlation sets, variables, handlers for compensations, faults and events WSDL for web service interface 2
Anatomy of BPEL process 3
BPEL requires an understanding of... XML and XPath What do you know about XML and XPath? XML Schema What do you know about XML Schema? WSDL What do you know about WSDL? 4
BPEL requires an understanding of... XML XPath Nested elements start and end-tags Attributes data types, IDs, IDREFs Navigate in XML structures to locate and extract data Used in the context of messages and variables XML Schema Define new types, i.e. legal XML structures 5
BPEL requires an understanding of... WSDL Port type something you can connect to using some protocol provides a set of operations corresponds to interface in OO modeling Operation something you can invoke with input and output data data are provided in messages consisting of parts corresponds to method in OO modeling Input and output data parts are XML types 6
BPEL requires an understanding of... WSDL port type operation input message 7
BPEL requires an understanding of... WSDL Partner link types describes the kind of message exchange that two WSDL services intend to carry out each service plays a role in this partnership each service provides a set of operations (capabilities) and declares the operations it needs from the other http://blogs.sun.com/gopalan/entry/bpel_what_are_partnerlinktypes_roles 8
BPEL overall object-model 9
BPEL concepts Activity a hierchical structure of various kinds of tasks Variable contains (references to) XML data used for messages and representation state refers to XML types defined in XML Schemas Partner link defines the collaborations that activities take part in refers to WSDL partner link types Correlation set defines how to identify the handling process, based in the content of incoming messages 10
BPEL concepts FaultHandler construct for defining where to catch and how to handle exceptions EventHandler special handling of messages and timers in a scope CompensationHandler Scope Process activities for undoing completed activities, that are triggered by the special compensate activity special activity with local variables and handlers top-level scope 11
BPEL Activity model 12
BPEL activity types Receive Invoke Reply Assign what for message that is part of specific partner link type input data is stored in variable invoke operation that is part of specific partner link type input data comes from variable asynchronous reply (output data) for invocation output data comes from variable set the value of (part of the XML structure of) a variable, based on the XML structure of other variables 13
BPEL activity types Switch (if-elseif-else) Flow branch based on condition refers to (the content of) variables parallell execution of sub-activities Sequence Pick While sequential execution of sub-activities branch based on event, either message or timer loop based on condition refers to (the content of) variables 14
BPEL example When a claim arrives, an agent evaluates it and determines whether to accept or reject it. If the agent does not respond within ten days, the activity is escalated to a manager, who makes an accelarated accept/reject decision. At any point, the processing can be terminated with a kill event. 15
BPEL example, BPMN TDT4250 - Model-driven Development of Information Systems, Autumn 2009 16
BPEL example 125 lines of XML code (see book) or diagram 17
Basic structure Start with sequence with a triggering activity, either receive or pick within flow Do not put basic activities (e.g., assign, empty, or wait) before the initial receive or pick. Do not use switch or while as the main activity of the process. Do not use a scope as the main activity of the process. The process has everything that a scope has handlers, variables, correlation sets. 18
Variables and assignments Variables are set in one of the following ways Bound to the input of an inbound activity, such as a receive, pick, or eventhandler. Bound to the output of a synchronous invoke. Assigned a value with the assign activity 19
Exception handling and compensation Compensate activity Undo the effect of completed activities Calls the compensation handler of a scope Fault handler Catch exceptions that are thrown Event handler Cancellation Escalation (example of use of onalarm ) 20
Split and join TDT4250 - Model-driven Development of Information Systems, Autumn 2009 Switch : exclusive-or With otherwise Flow: parallell execution/synchronization Parallell split and join More advanced patterns (page 122) 21
Loops TDT4250 - Model-driven Development of Information Systems, Autumn 2009 While (not foreach, although possible to implement) 22
Partner exchange Partner link types and partner links Partners Partner interactions Invoke Receive Reply Pick 23
Correlations TDT4250 - Model-driven Development of Information Systems, Autumn 2009 The purpose of the correlation set is to tie together a partner conversation. A fundamental principal of BPEL is that instances of partner processes communicate with each other simply by calling each other's web services, passing application data whose structure is transparent to the BPEL engine. In BPEL, partners do not address each other by ID, but rather pass around messages containing key fields that can be correlated for the lifetime of the exchange. 24
BPEL wish list foreach XML creation and update Lightweight subprocesses or macros More sophisticated correlation 25
BPEL and patterns 26
Mapping BPMN to BPEL 27
Summary BPMN and BPEL BPEL is an XML-based process definition language. The XML approach has several merits, including programmability, executability, exportability, and easy web services integration capabilities. The source code for a BPEL process is the BPEL (XML) file itself and a set of WSDL files, the latter specifying port types, partner link types, message types, and properties that the BPEL file references. The flow of a BPEL process includes service touchpoints (receive, invoke, reply) and control flow elements (wait, while, switch, flow, sequence, scope). BPMI's vision of a BPM stack includes BPMN as the visual modeling language, BPEL with BPXL extensions as the execution language, and BPDM as the process metamodel. BPMN is a graphical flowchart language with processes, activities, gateways, events, pools, and swimlanes as its main constructs. BPMN's mapping to BPEL is described at a high level; the holes in this mapping are attributable to BPMN's excess of features. BPMN was built with the P4 patterns in mind, and thus rates well on its support for patterns. 28