1 / 38

Chapter 5 Business Process Execution Language (BPEL)

Chapter 5 Business Process Execution Language (BPEL). Team 4 Don Little Jim Kile Samir Shah. Chapter Information. About BPEL History of Competing Standards Why BPEL? The Role of BPEL Orchestration Choreography How does BPEL work? BPEL in a Nutshell Developing BPEL process flow

lethia
Download Presentation

Chapter 5 Business Process Execution Language (BPEL)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 5Business Process Execution Language (BPEL) Team 4 Don Little Jim Kile Samir Shah

  2. Chapter Information • About BPEL • History of Competing Standards • Why BPEL? • The Role of BPEL • Orchestration • Choreography • How does BPEL work? • BPEL in a Nutshell • Developing BPEL process flow • Notations • BPEL Objects • Variables • Exception Handling & Compensation • Participant Exchange • Transactions • BPELJ (Java Extension to BPEL) • BPEL Example – Insurance Company • Suggested Enhancements of BPEL • Summary Team 4 - Chapter 5: BPEL

  3. About BPEL • BPEL (Business Process Execution Language) is a programming language written in XML for the definition and execution of business processes • Originally co-written by BEA Systems, IBM and Microsoft – published April 2003 • BPEL standard leverages 10+ years of research and development • Microsoft and IBM invested in XLANG and WSFL (web service flow language) Team 4 - Chapter 5: BPEL

  4. About BPEL (continued) • Reviewed and Revised by OASIS • OASIS = Organization for the Advancement of Structured Information Standards • BPEL has a wide support of the industry • IBM, Microsoft, Oracle, BEA, SAP, Siebel • Many practical uses possible with this technology Team 4 - Chapter 5: BPEL

  5. History of Competing Standards Source: http://www.radikalfx.com/bpel/usage.html Team 4 - Chapter 5: BPEL

  6. Why BPEL? • The development, testing and deployment efforts required to change ERP, CRM types of applications can be very costly and complex • Can be used to standardize enterprise application integration • Addresses the business process challenges such as • Coordinating asynchronous communication between services • Correlating message exchanges between parties • Implementing parallel processing of activities • Manipulating data between partner interactions • Providing consistent exception handling Team 4 - Chapter 5: BPEL

  7. Why BPEL (continued) • Provides companies the ability to quickly adapt or create new business processes – internally and externally • Provides an XML-based grammar for describing the logic to control and coordinate Web services participating in a process flow. • Once the business has defined the process it should be easier to plug and play the services that support it. • Provides an “Orchestration Engine” for describing exchanges of information internally or externally Team 4 - Chapter 5: BPEL

  8. The Role of BPEL • Defined in XML format • It contains variety of process flow constructs such as • Conditional branching • Parallel process flows • Nested-sub-processes • Process joints • Orchestration vs. Choreography Team 4 - Chapter 5: BPEL

  9. The Role of BPEL – Orchestration vs ChoreographyOrchestration Source: article: A Hands-on Introduction to BPEL by Matjaz Juric – http://www.oracle.com Team 4 - Chapter 5: BPEL

  10. Orchestration • BPEL supports two different ways of describing business processes that support orchestration • Executable Processes • Allow developers to specify exact details of business process paradigm • Can be executed by an orchestration engine • Abstract Business Protocols • Allow developers to specify the public message exchange between parties • Do not include the internal details of process flows • Are not executable Team 4 - Chapter 5: BPEL

  11. The Role of BPEL – Orchestration vs ChoreographyChoreography Source: article: A Hands-on Introduction to BPEL by Matjaz Juric – http://www.oracle.com Team 4 - Chapter 5: BPEL

  12. How does BPEL work? Source: Article: BPEL standardizes process management by Stephen Hood, Network World, 2005 Team 4 - Chapter 5: BPEL

  13. Example Source: article: A Hands-on Introduction to BPEL by Matjaz Juric – http://www.oracle.com Team 4 - Chapter 5: BPEL

  14. BPEL in a Nutshell

  15. BPEL – Overall Object Model Team 4 - Chapter 5: BPEL

  16. Developing BPEL process flow • BPEL is a process flow language and generally developed using a visual editor that creates a flow diagram • Application to application interaction (orchestration) • In develop the sample BPEL process, you will go through the following steps: • Step 1 - Get familiar with the involved Web services • Step 2 - Define the WSDL for the BPEL process • Step 3 - Define partner link types • Step 4 - Develop the BPEL process: • Define partner links • Declare variables • Write the process logic definition • The language is complete enough to define any business process flow Team 4 - Chapter 5: BPEL

  17. Step 1 – Inventory the Involved Web Services • Defining partner web services • Example – American and Delta Airline’s web service which have identical WSDL descriptions… Team 4 - Chapter 5: BPEL

  18. Step 2 – Define WSDL for the BPEL process • Next, we have to expose the business travel BPEL as a Web service. The second step is therefore to define the WSDL for it. The process has to receive messages from its clients and return results…. Team 4 - Chapter 5: BPEL

  19. Step 3 – Define Partner Link Types • Partner link types represent the interaction between a BPEL process and the involved parties, which include the Web services the BPEL process invokes and the client that invokes the BPEL process • Example <plnk:partnerLinkType name="travelLT"> <plnk:role name="travelService"> <plnk:portType name="tns:TravelApprovalPT" /> </plnk:role> <plnk:role name="travelServiceCustomer"> <plnk:portType name="tns:ClientCallbackPT" /> </plnk:role> </plnk:partnerLinkType> Team 4 - Chapter 5: BPEL

  20. Step 4 – Create the Business Process • Typically, a BPEL process waits for an incoming message from the client, which starts the execution of the business process. In our example the client initiates the BPEL process through sending an input message: • Example <process name="BusinessTravelProcess" ... > <partnerLinks> <!-- The declaration of partner links --> </partnerLinks> <variables> <!-- The declaration of variables --> </variables> <sequence> <!-- The definition of the BPEL business process main body --> </sequence> </process> Team 4 - Chapter 5: BPEL

  21. Notations • Some of the notations include • Wait for an event • Transform a message • Decision point where the process will take one path rather than another • Parallel flow where activities can be processed simultaneously • Invoke an external service and wait for a response • Signaling failure situation and defining compensation processing Team 4 - Chapter 5: BPEL

  22. BPEL Objects • BPEL process consists of steps and each step is called an “activity” • Activities represent basic constructs and are used for common tasks such as following: • <invoke> - Invoking other web services • <reply> - Generating a response for synchronous operations • <throw> - indicating faults and exceptions • <terminate> - Terminating the entire process • <wait> - waiting for some time Team 4 - Chapter 5: BPEL

  23. BPEL Objects • To combine primitive activities, BPEL supports several structure activities. The most important are: • Sequence (<sequence>), which allows us definition of a set of activities that will be invoked in an ordered sequence • Flow (<flow>) for defining a set of activities that will be invoked in parallel • Case-switch construct (<switch>) for implementing branches • While (<while>) for defining loops • The ability to select one of several alternative paths, using <pick> • <partner link> - define partner links • <variables> - declare variables Team 4 - Chapter 5: BPEL

  24. Variables • Used to store, reformat, and transform messages. • Variable declaration needed for every message sent to and received from partners • For each variable you need to specify • WSDL message type • XML Schema Simple type • XML Schema element • message types for all variables Team 4 - Chapter 5: BPEL

  25. Variables (examples) Team 4 - Chapter 5: BPEL

  26. Exception Handling and Compensation • When a fault is generated, either implicitly by the BPEL engine or explicitly by a throw activity, control jumps to the fault handler defined for the given fault type. • The fault handler is a set of catch structures <scope name=“s1”> <faultHandlers> <catch faultName=“x:invalidAccount”> ….. </catch> <catch faultName=“x:closedAccount”> ……. </catch> <catchAll”> …….. </catchAll”> </faultHandlers> </scope> Team 4 - Chapter 5: BPEL

  27. Participant Exchange • Processes communicate with each other as business partners • Relationships are represented declaratively in the definition of process links and in the actual communication touch points of the process flow • Partner Link Types • <partnerLinkType> • Partner Links • <partnerLink name = “….”> • Partners • <partner name=“….”> Team 4 - Chapter 5: BPEL

  28. Participant Exchange Team 4 - Chapter 5: BPEL

  29. BPEL Example (Insurance Company) • Example 5.1 • 1 <process name="InsuranceClaim" • 2 targetNamespace="http://acm.org/samples" • 3 suppressJoinFailure="yes" • 4 xmlns:tns=http://acm.org/samples • 5 xmlns=http://schemas.xmlsoap.org/ws/2003/03/business-process/ • 6 xmlns:xsd=http://www.w3.org/2001/XMLSchema • 7 xmlns:addressing=http://schemas.xmlsoap.org/ws/2003/03/addressing • 8 xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/"> • 9 • 10 <!-- • 11 Partners in the process: • 12 client - app that can initiate and kill • 13 worklist - service that manages manual activities • 14 --> • 15 <partnerLinks> • 16 <!-- • 17 <partnerLink name="client" partnerLinkType="tns:InsuranceClaim" • 18 myRole="InsuranceClaimProvider"/> • 19 <partnerLink name="worklist" partnerLinkType="task:TaskManager" • 20 partnerRole="TaskManager" myRole="TaskManagerRequester"/> • 21 </partnerLinks> • 22 • 23 <!-- Process-level variables --> • 24 <variables> • 25 <variable name="status" type="xsd:string"/> • 26 <variable name="initiateMsg" messageType="tns:InsuranceClaimMsg"/> • 27 <variable name="killEv" messageType="tns:InsuranceClaimMsg"/> • 28 <variable name="taskResponse" messageType="task:taskMessage"/> • 29 </variables> • 30 • 31 <!-- Message correlation to be performed on the ClaimID field --> • 32 <correlationSets> • 33 <correlationSet name="claim" properties="tns:claimID"/> • 34 </correlationSets> • 35 Team 4 - Chapter 5: BPEL

  30. BPEL Example (Insurance Company) • 36 <!-- Catch any errors and fix manually --> • 37 <faultHandlers> • 38 <catchAll> • 39 <empty name="PlaceholderForManualFix"/> • 40 </catchAll> • 41 </faultHandlers> • 42 • 43 <!-- Globally receive a kill event (correlated with the claim ID from the • 44 original initate) and terminate the process. --> • 45 <eventHandlers> • 46 <onMessage partnerLink="client" portType="tns:InsuranceClaim" • 47 operation="kill" variable="killEv"> • 48 <correlations> • 49 <correlation set="claim" initiate="no"/> • 50 </correlations> • 51 <sequence> • 52 <empty/><!-- Do something, like notify internal systems of kill --> • 53 <terminate name="killClaim"/> • 54 </sequence> • 55 </onMessage> • 56 </eventHandlers> • 57 • 58 <sequence> • 59 • 60 <!-- We start with a receive activity: get the initiate message. Will • 61 correlate on claim set defined earlier • 62 --> • 63 <receive partnerLink="client" portType="tns:InsuranceClaim" • 64 operation="initiate" variable="initiateMsg" createInstance="yes" • 65 name="initiateEvent"> • 66 <correlations> • 67 <correlation set="claim" initiate="yes"/> • 68 </correlations> • 69 </receive> Team 4 - Chapter 5: BPEL

  31. BPEL Example (Insurance Company) • 71 <!-- Let an agent evaluate it. Call worklist partner to do this --> • 72 <invoke name="evalClaim" partnerLink="worklist" portType="task:TaskManager" • 73 operation="evalClaim" inputVariable="initiateMsg"/> • 74 • 75 <!-- Get either the response or a timeout --> • 76 <pick name="analyzePick"> • 77 <onMessage partnerLink="worklist" portType="task:TaskManagerCallback" • 78 operation="onTaskResult" variable="taskResponse"> • 79 <!-- From response extract status and set to variable 'status' --> • 80 <assign name="setStatus"> • 81 <copy> • 82 <from variable="taskResponse" part="payload" • 83 query="/tns:taskMessage/tns:result="/> • 84 <to variable="status"/> • 85 </copy> • 86 </assign> • 87 </onMessage> • 88 <!-- Timeout! 10 days have passed. Escalate --> • 89 <onAlarm for="PT10D"> • 90 <sequence> • 91 <!-- Call partner service to escalate --> • 92 <invoke name="evalClaim" partnerLink="worklist" • 93 portType="task:TaskManager" operation="escalateClaim" • 94 inputVariable="initiateMsg"/> • 95 <!-- Get the escalation response --> • 96 <receive name="receiveTaskResult" partnerLink="worklist" • 97 portType="task:TaskManagerCallback" • 98 operation="onTaskResult" variable="taskResponse"/> Team 4 - Chapter 5: BPEL

  32. BPEL Example (Insurance Company) • 101 <copy> • 102 <from variable="taskResponse" part="payload" • 103 query="/tns:taskMessage/tns:result="/> • 104 <to variable="status"/> • 105 </copy> • 106 </assign> • 107 </sequence> • 108 </onAlarm> • 109 </pick> • 110 • 111 <!-- Look at result of claim process and act accordingly: • 112 'rejected' and 'accepted' are good. Anything else, throw a fault --> • 113 <switch name-"resultEval"> • 114 <case condition="bpws:getVariableData('status')='rejected'"> • 115 <empty> <!-- perform rejection actions --> • 116 </case> • 117 <case condition="bpws:getVariableData('status')='accepted'"> • 118 <empty> <!-- perform acceptance actions --> • 119 </case> • 120 <otherwise> • 121 <throw name="illegalStatus" faultName="illegalStatus"/> • 122 </otherwise> • 123 </switch> • 124 </sequence> • 125 </process> Team 4 - Chapter 5: BPEL

  33. BPELJ (Java Extension) • BPELJ – choice for companies that intend to deploy their processes on J2EE platforms • IBM WebSphere, BEA Weblogic Team 4 - Chapter 5: BPEL

  34. BPELJ (Java Extension) Process WS J J J J Process Process WS POJO EJB JMS JDBC JCA Team 4 - Chapter 5: BPEL

  35. BPELJ (Java Extension) • Example of BPELJ • 1 <!- - Process attributes: • 2 - expressionLanguage is Java by default. Can be overriden to, • 3 say, XPath at the element level • 4 - Java code embedded in process goes in to the Java package "com.mike.claim" • 5 - The BPELJ namespace is referenced below. • 6 <process name="InsuranceClaim" • 7 suppressJoinFailure="yes" • 8 expressionLanguage="http://jcp.org/java" • 9 bpelj:package="com.mike.claim" • 10 targetNamespace="http://mike.com/claim" • 11 xmlns:tns="mike.com/claim" • 12 xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/" • 13 xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/" • 14 xmlns:bpelj="http://schemas.xmlsoap.org/ws/2003/03/business-process/java"> • 15 • 16 <!-- Three partner links: one a web service client interface, the others • 17 Java internal stuff --> • 18 <partnerLinks> • 19 <partnerLink name="client" partnerLinkType="tns:Claim" • 20 myRole="ClaimProvider"/> • 21 <partnerLink name="claimProcessor" • 22 partnerLinkType="bpelj:com.mike.claim.ClaimProcessorEJB"> • 23 <partnerLink name="jmsPublisher" • 24 partnerLinkType="bpelj:javax.jms.TopicPublisher"> • 25 </partnerLinks> • 26 • 27 <!-- Two variables, one an XML, the other Java --> • 28 <variables> • 29 <variable name="input" messageType="tns:ClaimsMessage"/> • 30 <variable name="jmsMessage" messageType="bpelj:javax.jms.TextMessage"/> • 31 <variable name="claimOK" messageType="bpelj:java.lang.Boolean "/> • 32 </variables> Team 4 - Chapter 5: BPEL

  36. BPELJ (Java Extension) • 33 • 34 <sequence name="main"> • 35 <!-- process starts by receiving a claim through the client web service --> • 36 <receive name="receiveClaim" partnerLink="client" portType="tns:Claim" • 37 operation="initiate" createInstance="yes"> • 38 <output part="input" variable="input/> • 39 </receive> • 40 • 41 <!-- now invoke the Java claims processor as a partner link! --> • 42 <invoke name="processClaim" partnerLink="claimProcessor" operation="execute"> • 43 <input part="input" variable="input"/> • 44 <output variable="claimOK"/> • 45 </invoke> • 46 • 47 <!-- if claim is ok, publish the original input on a JMS topic --> • 48 <switch name="pubIfOK"> • 49 <case> • 50 <condition>claimOK</condition> • 51 <bpelj:snippet name="createJMSMessage"> • 52 <!-- Use partner link topic publisher to allocate a JMS message • 53 and populate it with the claim input message. • 54 Note "p_jmsPublisher" is the way to reference the partner • 55 link "jmsPublisher" in BPELJ --> • 56 <bpelj:code> • 57 jmsMessage=p_jmsPublisher.getSession( ).createTextMessage(input); • 58 </bpelj:code> • 59 </bpelj:snippet> • 60 <invoke name="PubClaim" partnerLink="jmsPublisher" operation="publish" • 61 <input part="message" variable="jmsMessage"/> • 62 </invoke> • 63 </case> • 64 <otherwise> • 65 <empty/> <!-- do nothing in this case --> • 66 </otherwise> • 67 </switch> • 68 • 69 </sequence> • 70 </process> Team 4 - Chapter 5: BPEL

  37. Enhancements of BPEL • The following enhancements would make BPEL more powerful and easier to use … • Foreach • Activity that can iterate over a data set • XML creation and update • “Assign” activity to support the construction of XML elements or documents • Lightweight sub-processes or macros • Provide a mechanism to factor out a chunk of code into a modular piece • Business Calendars • Provide a standard way to reference business calendars in the calculation of timeout conditions in “wait” and “onAlarm” activities Team 4 - Chapter 5: BPEL

  38. Chapter Summary • BPEL – an XML-based process definition language • Source code of BPEL is a set of WSDL files and a BPEL XML file • Merits • Programmability • Ability to execute • Exportability • Easy web services integration capabilities Team 4 - Chapter 5: BPEL

More Related