Web Services (NSWI145)Lecture 09: WS BPELMartin Nečaský, Ph.D.Faculty of Mathematics and PhysicsCharles University in Prag...
Core WS Technologies SOAP defines XML messaging protocol for basic webservice interoperability WSDL introduces common ...
Business Process Automation ordering of activities with beginning and endperformed to achieve business outcome has input...
Business Process Automation WSDL provides only stateless model forparticular request-response message exchange, or unco...
Business Process Automation core WS technologies allow automation ofonly particular message exchange we need additional ...
WS Orchestration specifies an executable process result is a web service view of one party that controls the process W...
WS Choreography specifies a sequence of messages between collaboratingpartners and resources how they should communicate...
BPEL XML based language for orchestrating WebServices BPEL has two parts extensions to WSDL business process execution...
Sample ProcessReceive Purchase OrderSend InvoiceCheck Credit CardProcess PaymentCalculate PurchaseOrder PriceArrange Logis...
BPEL BPEL process = Abstract Web Service has WSDL description• port types composed of operations with inputs andoutputs•...
Process Exposition with WSDL exposes BPEL process as a web servicedescribed with WSDL WSDL 1.1 file with few restriction...
Process Exposition with WSDLPurchaseOrderProcessPurchaseOrderPortTypesendPurchaseOrderOperationCustomerPurchase OrderInvoi...
Process Exposition with WSDL<wsdl:description targetNamespace="http://purchase" ...>...<wsdl:portType name="PurchaseOrderP...
Process Exposition with WSDL WSDL 1.1 file with few restrictions andextensions extensions• partner link type– characteri...
CreditCardServiceCreditCardPortTypecheckCreditCardOperationProcess Exposition with WSDLPurchaseOrderProcessCreditCardCallb...
Process Exposition with WSDL<wsdl:description targetNamespace="http://purchase" ...>...<wsdl:portType name="CreditCardCall...
Process Exposition with WSDL<wsdl:descriptiontargetNamespace="http://creditcard" ...>...<wsdl:portType name="CreditCardPor...
Process Exposition with WSDL element partnerLinkType WSDL extension specifies WSDL port types the process offers to and...
Process Exposition with WSDL<wsdl:description xmlns:plnk ="http://docs.oasis-open.org/wsbpel/2.0/plnktype">...<plnk:partne...
Process Exposition with WSDL<wsdl:description xmlns:plnk ="http://docs.oasis-open.org/wsbpel/2.0/plnktype">...<plnk:partne...
Process Definition root element process with four major sections: partnerLinks section• relationships from process to ex...
Process Exposition with WSDL<process xmlns ="http://docs.oasis-open.org/wsbpel/2.0/process/executable"><partnerLinks>...</...
Process Definition – Partner Link specified by element partnerLink models a link between the process and apartner servic...
Process Definition – Partner Link attribute myRole references the role in the partner link type actedby the process att...
Process Definition – Partner Link<process><partnerLinks><partnerLink name="CreditCardLink"partnerLinkType="pos:CreditCardL...
Process Definition – Partner Link<process><partnerLinks>...<partnerLink name="PurchaseOrderRequestLink"partnerLinkType="po...
Process Definition – Variable element variable variables hold data that constitute the state of theprocess attribute na...
Process Definition – Variable<process><variables><variable name="PurchaseOrderMessage"messageType="pos:PurchaseOrder" /><v...
Process Definition - Activities specify the process itself (main activity) or fault handling several types of activities...
Process Definition – invoke allows business process to call a partner service invokes one-way or request-response operat...
Process Definition – invoke<process><invokename="CreditCardCheckInvoke"partnerLink="CreditCardLink"operation="checkCreditC...
Process Definition – receive allows business process to receive a messagefrom a partner service blocking activity attri...
Process Definition – receive attribute variable specifies variable where the arrival message willbe assigned attribute ...
Process Definition – receive<process><receivename="PurchaseOrderRequestFromCustomer"partnerLink="PurchaseOrderRequestLink"...
Process Definition – reply allows business process to send a message ina reply to a message that was received byreceive ...
Process Definition – reply<process><replyname="InvoiceReplyToCustomer"partnerLink="PurchaseOrderRequestLink"operation="pro...
Process Definition – receive/reply implements request/response messageexchange pattern it is a pair if there are more p...
Process Definition – assign allows updating values of variables with newdata copying data from one variable to another ...
Process Definition – assign several variants of from and to:1. from variable to variable<assign><copy><from variable="c1"...
Process Definition – assign several variants of from and to:2. from variable part to variable<assign><copy><from>$c1/line...
Process Definition – assign several variants of from and to:3. from XSLT script to variable<assign><copy><from>bpel:doXsl...
Process Definition – sequence specifies activities to be performedsequentiallySummer 2013
Process Definition – sequence<process><sequence><receive name="PurchaseOrderRequestFromCustomer" ... /><assign><copy><from...
Process Definition – flow specifies one or more activities to beperformed concurrentlySummer 2013
Process Definition – flow<process><flow><sequence><invoke name="CreditCardCheckInvoke" ... /><invoke name="ProcessPaymentI...
Process Definition – flow element link declares synchronization dependency for flow attribute name• identifies dependen...
Process Definition – flow<process><flow><links><link name="PriceToPaymentLink" /></links>...</flow></process>Summer 2013
Process Definition – flow each activity may contain sources with one or moresource and targets with one or more target e...
Process Definition – flow for a given link, its target activities must waituntil its source activities have finishedSumme...
Process Definition – flow<process><flow>...<invoke name="CalculatePriceInvoke" ... ><sources><source name="PriceToPaymentL...
Process Definition – flow<process><flow>...<sequence><invoke name="CreditCardCheckInvoke" ... /><invoke name="ProcessPayme...
Process Definition – flow element joinCondition in targets contains logical expression specifying waitingconditionSummer...
Process Definition – flow<flow><links>...</links><sequence name="W"><targets><joinCondition>$XtoW and $YtoW</joinCondition...
Process Definition – flow element transitionCondition insource contains logical expression specifying condition forsetti...
Process Definition – flow<flow><links>...</links><sequence name="X"><sources><source linkName="XtoV"><transitionCondition>...
Process Definition – scope allows definition of local partnerlinks, variables and activitiesSummer 2013
Process Definition – if used to select exactly one activity from given branches branch = activity first branch is direc...
Process Definition – if<if><invoke>...</invoke><condition>$PaymentMessage/price &gt; 1000</condition><elseif><invoke>...</...
Process Definition – while used to define that the child activity is to berepeated as long as the specified condition ist...
Process Definition – while<while><condition>$c1 &gt; 1000</condition><sequence><invoke>...</invoke><assign><from>...</from...
Process Definition – forEach iterates its child scope exactly N+1 timeswhere N is given by finalCounterValuechild element...
Process Definition – forEach<forEach parallel="yes" countername="n"><startCounterValue>1</startCounterValue><finalCounterV...
Advanced Concepts not presented in this lecture: fault handling event handling terminating processes undoing complete...
Upcoming SlideShare
Loading in …5
×

Web Services - Business Process Execution Language

587 views
497 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
587
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
16
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Web Services - Business Process Execution Language

  1. 1. Web Services (NSWI145)Lecture 09: WS BPELMartin Nečaský, Ph.D.Faculty of Mathematics and PhysicsCharles University in Prague, Czech RepublicSummer 2013
  2. 2. Core WS Technologies SOAP defines XML messaging protocol for basic webservice interoperability WSDL introduces common grammar for describing webservicesSummer 2013
  3. 3. Business Process Automation ordering of activities with beginning and endperformed to achieve business outcome has inputs and outputsSummer 2013
  4. 4. Business Process Automation WSDL provides only stateless model forparticular request-response message exchange, or uncorrelated one-way message exchange typical model of business interaction sequence of particular peer-to-peer messageexchanges• request-response and/or one-way stateful, long running interactions involving two ormore partiesSummer 2013
  5. 5. Business Process Automation core WS technologies allow automation ofonly particular message exchange we need additional WS technologies tosupport automation of whole businessprocesses core terms WS orchestration WS choreographySummer 2013
  6. 6. WS Orchestration specifies an executable process result is a web service view of one party that controls the process WS-BPEL: Web Services Business ProcessExecution LanguageSummer 2013
  7. 7. WS Choreography specifies a sequence of messages between collaboratingpartners and resources how they should communicate with each other not an executable process no particular view of particular partner WS-CDL: Web Services Choreography DescriptionLanguageSummer 2013
  8. 8. BPEL XML based language for orchestrating WebServices BPEL has two parts extensions to WSDL business process execution constructs BPEL script (internal process specification) +WSDL document (external process specification) define new Web Service implemented asorchestration of other Web Services requires WSDL 1.1 (WSDL 2.0 not supported)Summer 2013
  9. 9. Sample ProcessReceive Purchase OrderSend InvoiceCheck Credit CardProcess PaymentCalculate PurchaseOrder PriceArrange LogisticsSummer 2013
  10. 10. BPEL BPEL process = Abstract Web Service has WSDL description• port types composed of operations with inputs andoutputs• operates only on the level of WSDL portTypes– no binding to concrete services specified by WS-BPEL processdescription orchestrates other web servicesSummer 2013
  11. 11. Process Exposition with WSDL exposes BPEL process as a web servicedescribed with WSDL WSDL 1.1 file with few restrictions andextensions restrictions• no service and binding is defined• only types, messages, port types with operationsSummer 2013
  12. 12. Process Exposition with WSDLPurchaseOrderProcessPurchaseOrderPortTypesendPurchaseOrderOperationCustomerPurchase OrderInvoiceSummer 2013
  13. 13. Process Exposition with WSDL<wsdl:description targetNamespace="http://purchase" ...>...<wsdl:portType name="PurchaseOrderPortType"><wsdl:operation name="sendPurchaseOrderOperation"><wsdl:input name="pos:PurchaseOrder" /><wsdl:output name="pos:Invoice" /></wsdl:operation></wsdl:portType></wsdl:description>Summer 2013
  14. 14. Process Exposition with WSDL WSDL 1.1 file with few restrictions andextensions extensions• partner link type– characterization of conversational relationships betweenprocess and its partner• partner link type between process and web serviceutilized by process– two participants (process and web service) each with own role• partner link type between process and its client– one participant (process) with own roleSummer 2013
  15. 15. CreditCardServiceCreditCardPortTypecheckCreditCardOperationProcess Exposition with WSDLPurchaseOrderProcessCreditCardCallbackPortTypeprocessPaymentOperationconfirmCreditCardOperationCreditCardConfirmationconfirmPaymentOperationPaymentConfirmationpartner linktypeCreditCardPaymentSummer 2013
  16. 16. Process Exposition with WSDL<wsdl:description targetNamespace="http://purchase" ...>...<wsdl:portType name="CreditCardCallbackPortType"><wsdl:operation name="confirmCreditCardOperation"><wsdl:input name="cc:CreditCardConfirmation" /></wsdl:operation><wsdl:operation name="confirmPaymentOperation"><wsdl:input name="cc:PaymentConfirmation" /></wsdl:operation></wsdl:portType></wsdl:description>Summer 2013
  17. 17. Process Exposition with WSDL<wsdl:descriptiontargetNamespace="http://creditcard" ...>...<wsdl:portType name="CreditCardPortType"><wsdl:operation name="checkCreditCardOperation"><wsdl:input name="cc:CreditCard" /><wsdl:output name="cc:CreditCardConfirmation" /></wsdl:operation><wsdl:operation name="processPaymentOperation"><wsdl:input name="cc:Payment" /><wsdl:output name="cc:PaymentConfirmation" /></wsdl:operation></wsdl:portType></wsdl:description>Summer 2013
  18. 18. Process Exposition with WSDL element partnerLinkType WSDL extension specifies WSDL port types the process offers to and requiresfrom a partner service attribute name• unique name of the partner link type within the scope of theWSDL description two (typically) or one element role• each specifies role one of the communicating services acts• attribute name– unique name of the role within the partner link type• attribute portType– specifies WSDL port type the service acting in this role must offerSummer 2013
  19. 19. Process Exposition with WSDL<wsdl:description xmlns:plnk ="http://docs.oasis-open.org/wsbpel/2.0/plnktype">...<plnk:partnerLinkType name="CreditCardLinkType"><plnk:role name="CreditCardServiceRole"portType="cc:CreditCardPortType" /><plnk:role name="CreditCardClientRole"portType="pos:CreditCardCallbackPortType" /></plnk:partnerLinkType></wsdl:description>Summer 2013
  20. 20. Process Exposition with WSDL<wsdl:description xmlns:plnk ="http://docs.oasis-open.org/wsbpel/2.0/plnktype">...<plnk:partnerLinkType name="PurchaseOrderRequestLinkType"><plnk:role name="PurchaseOrderServiceRole"portType="pos:PurchaseOrderPortType" /></plnk:partnerLinkType></wsdl:description>Summer 2013
  21. 21. Process Definition root element process with four major sections: partnerLinks section• relationships from process to external partner services variables section• declaration of process data faultHandlers section• handlers for processing faults main activity• activity to be executed by the processSummer 2013
  22. 22. Process Exposition with WSDL<process xmlns ="http://docs.oasis-open.org/wsbpel/2.0/process/executable"><partnerLinks>...</partnerLinks><variables>...</variables><faultHandlers>...</faultHandlers><!–- {MAIN ACTIVITY} --></process>Summer 2013
  23. 23. Process Definition – Partner Link specified by element partnerLink models a link between the process and apartner service instance of a partner link type attribute name unique name of the partner link within theprocess attribute partnerLinkType reference to the partner link typeSummer 2013
  24. 24. Process Definition – Partner Link attribute myRole references the role in the partner link type actedby the process attribute partnerRole references the role in the partner link type actedby the partner serviceSummer 2013
  25. 25. Process Definition – Partner Link<process><partnerLinks><partnerLink name="CreditCardLink"partnerLinkType="pos:CreditCardLinkType"myRole="CreditCardClientRole"partnerRole="CreditCardServiceRole" />...</partnerLinks>...</process>Summer 2013
  26. 26. Process Definition – Partner Link<process><partnerLinks>...<partnerLink name="PurchaseOrderRequestLink"partnerLinkType="pos:PurchaseOrderRequestLinkType"myRole="PurchaseOrderServerRole" />...</partnerLinks>...</process>Summer 2013
  27. 27. Process Definition – Variable element variable variables hold data that constitute the state of theprocess attribute name• unique variable name content type of the variable specified as WSDLmessage type, XSD element or XSD simple/complextype• attribute messageType– reference to WSDL message type• attribute element– reference to XSD element declaration• attribute type– reference to XSD simple/complex type definitionSummer 2013
  28. 28. Process Definition – Variable<process><variables><variable name="PurchaseOrderMessage"messageType="pos:PurchaseOrder" /><variable name="CreditCardMessage"messageType="cc:CreditCard" /><variable name="CreditCardConfirmationMessage"messageType="cc:CreditCardConfirmation" /><variable name="InvoiceMessage"messageType="pos:Invoice" />... </variables>... </process>Summer 2013
  29. 29. Process Definition - Activities specify the process itself (main activity) or fault handling several types of activities: messaging activities• invoke, receive, reply, assign, … structured activities• sequence, flow, if, while, … fault activities• throw, exit, … compensation activities• compensate, …Summer 2013
  30. 30. Process Definition – invoke allows business process to call a partner service invokes one-way or request-response operation on a partners porttype attribute partnerLink specifies invoked partner port type attribute operation specifies invoked operation of the partner port type attribute inputVariable specifies variable with the input message can be replaced by toParts element with toPart child elements ifthe input message has more parts attribute outputVariable specifies variable with the output message can be replaced by fromParts element with fromPart childelements if the output message has more partsSummer 2013
  31. 31. Process Definition – invoke<process><invokename="CreditCardCheckInvoke"partnerLink="CreditCardLink"operation="checkCreditCard"inputVariable="CreditCardMessage"outputVariable="CreditCardConfirmationMessage" /></process>Summer 2013
  32. 32. Process Definition – receive allows business process to receive a messagefrom a partner service blocking activity attribute partnerLink specifies port type of the process that is awaitedto be invoked by the partner attribute operation specifies operation of the port type that is awaitedto be invoked by the partnerSummer 2013
  33. 33. Process Definition – receive attribute variable specifies variable where the arrival message willbe assigned attribute createInstance "yes"/"no" value if "yes" the activity creates new processinstanceSummer 2013
  34. 34. Process Definition – receive<process><receivename="PurchaseOrderRequestFromCustomer"partnerLink="PurchaseOrderRequestLink"operation="processPurchaseOrder"variable="PurchaseOrderMessage"createInstance="yes" /></process>Summer 2013
  35. 35. Process Definition – reply allows business process to send a message ina reply to a message that was received byreceive similar structure to invokeSummer 2013
  36. 36. Process Definition – reply<process><replyname="InvoiceReplyToCustomer"partnerLink="PurchaseOrderRequestLink"operation="processPurchaseOrder"variable="InvoiceMessage" /></process>Summer 2013
  37. 37. Process Definition – receive/reply implements request/response messageexchange pattern it is a pair if there are more pairs, distinguish them byattribute messageExchangeSummer 2013
  38. 38. Process Definition – assign allows updating values of variables with newdata copying data from one variable to another construct new data and copy them to a variable type validity checked element copy element from element toSummer 2013
  39. 39. Process Definition – assign several variants of from and to:1. from variable to variable<assign><copy><from variable="c1" /><to variable="c2" /></copy></assign>Summer 2013
  40. 40. Process Definition – assign several variants of from and to:2. from variable part to variable<assign><copy><from>$c1/lines/line[1]</from><to variable="c2" /></copy></assign>Summer 2013
  41. 41. Process Definition – assign several variants of from and to:3. from XSLT script to variable<assign><copy><from>bpel:doXslTransform(".../t.xsl", $c1)</from><to variable="c2" /></copy></assign>Summer 2013
  42. 42. Process Definition – sequence specifies activities to be performedsequentiallySummer 2013
  43. 43. Process Definition – sequence<process><sequence><receive name="PurchaseOrderRequestFromCustomer" ... /><assign><copy><from>$PurchaseOrderMessage/creditCard</from><to variable="CreditCardMessage" /></copy></assign><invoke name="CreditCardCheckInvoke" ... /><assign>...</assign><reply name="InvokeReplyToCustomer /></sequence> </process>Summer 2013
  44. 44. Process Definition – flow specifies one or more activities to beperformed concurrentlySummer 2013
  45. 45. Process Definition – flow<process><flow><sequence><invoke name="CreditCardCheckInvoke" ... /><invoke name="ProcessPaymentInvoke" ... /></sequence><invoke name="CalculatePriceInvoke" ... /><invoke name="LogisticsInvoke" ... /></flow></process>Summer 2013
  46. 46. Process Definition – flow element link declares synchronization dependency for flow attribute name• identifies dependency within flowSummer 2013
  47. 47. Process Definition – flow<process><flow><links><link name="PriceToPaymentLink" /></links>...</flow></process>Summer 2013
  48. 48. Process Definition – flow each activity may contain sources with one or moresource and targets with one or more target establish synchronization relations via links element source attribute linkName - specifies that the activity is sourceactivity of the link element target attribute linkName - specifies that the activity is targetactivity of the linkSummer 2013
  49. 49. Process Definition – flow for a given link, its target activities must waituntil its source activities have finishedSummer 2013
  50. 50. Process Definition – flow<process><flow>...<invoke name="CalculatePriceInvoke" ... ><sources><source name="PriceToPaymentLink" /></sources></invoke>...</flow></process>Summer 2013
  51. 51. Process Definition – flow<process><flow>...<sequence><invoke name="CreditCardCheckInvoke" ... /><invoke name="ProcessPaymentInvoke" ... ><targets><target name="PriceToPaymentLink" /></target></invoke></sequence>...</flow></process>Summer 2013
  52. 52. Process Definition – flow element joinCondition in targets contains logical expression specifying waitingconditionSummer 2013
  53. 53. Process Definition – flow<flow><links>...</links><sequence name="W"><targets><joinCondition>$XtoW and $YtoW</joinCondition><target linkName="XtoW" /><target linkName="YtoW" /></targets>...</sequence></flow>Summer 2013
  54. 54. Process Definition – flow element transitionCondition insource contains logical expression specifying condition forsetting the link to true (additional condition to"being finished")Summer 2013
  55. 55. Process Definition – flow<flow><links>...</links><sequence name="X"><sources><source linkName="XtoV"><transitionCondition>$c &gt; 1000</transitionCondition></source><source linkName="XtoW"><transitionCondition>$c &le; 1000</transitionCondition></source></sources>...</sequence></flow>Summer 2013
  56. 56. Process Definition – scope allows definition of local partnerlinks, variables and activitiesSummer 2013
  57. 57. Process Definition – if used to select exactly one activity from given branches branch = activity first branch is directly as child element condition contains logical expression condition for first branch activity element elseif element condition other branch activity under a condition element else last branchSummer 2013
  58. 58. Process Definition – if<if><invoke>...</invoke><condition>$PaymentMessage/price &gt; 1000</condition><elseif><invoke>...</invoke><condition>$PaymentMessage/price&gt;500</condition></elseif><else><invoke>...</invoke></else></if>Summer 2013
  59. 59. Process Definition – while used to define that the child activity is to berepeated as long as the specified condition istrue element condition contains logical expressionSummer 2013
  60. 60. Process Definition – while<while><condition>$c1 &gt; 1000</condition><sequence><invoke>...</invoke><assign><from>...</from><to>$c1</to></assign></sequence></while>Summer 2013
  61. 61. Process Definition – forEach iterates its child scope exactly N+1 timeswhere N is given by finalCounterValuechild element minus startCounterValuechild element iterated activity is in the child scope attribute parallel "yes"/"no" value if "yes" iterations are performed in parallel  flow with N+1 activities each for one iterationSummer 2013
  62. 62. Process Definition – forEach<forEach parallel="yes" countername="n"><startCounterValue>1</startCounterValue><finalCounterValue>count($PurchaseOrder//item)</finalCounterValue><scope>... variable $n with actual counter value ...... iterated activity ...</scope></forEach>Summer 2013
  63. 63. Advanced Concepts not presented in this lecture: fault handling event handling terminating processes undoing completed work (i.e. compensations) message correlation dynamic partner resolution abstract processesSummer 2013

×