BPEL4WS Series

Process Modeling

Abstract

In this article, we will walk through modeling a sample process using the Business Process Execution Language for Web Services. This article uses Sybase PowerDesigner as the modeling tool and J2EE 1.4 as the programming and deployment platform. The article assumes basic knowledge of BPEL4WS, UML, WSDL and J2EE technologies.

About Sybase PowerDesigner®

One of the most innovative UML tools in the market is Sybase PowerDesigner. If you have been working with UML for a long time, you probably have passed through using many UML tools, but if you left PowerDesigner behind, you have to reconsider. This tool offers a series of automatic code generators, reverse-engineering and roundtrip engineering (synchronization of code and model) capabilities that significantly reduce manual coding, maintenance and re-engineering efforts. PowerDesigner Supports 45+ RDBMS, leading application development platforms like Java J2EE, Microsoft .NET, Web Services and PowerBuilder®, and process execution languages like ebXML and BPEL4WS, it also features a flexible and highly extendable meta-model with a fully scriptable COM-compliant interface. Sybase offers a full featured trial version here.

The Loan Approval Process Example

Overview

The process illustrates a customer sending a SOAP request asking for a possibility to get a loan from a financial institution. The request gets processed through a sequence of logic execution or invocation of other web services in order to return an appropriate reply for the customer request, then the customer finds out whether the loan was approved or not.

Partners

In order for the loan to get processed a customer has to initiate the loan request, approver has to approve the loan and assessor helps in evaluating the risk of the requested loan. Each of these three Organization Units or partners shown in the next diagram plays a role in the process. To get involved into the process, a partner link has to be defined on the process level pointing to an abstract partner link type which in return defines physical port. All partner links of this type can be communicated later on through this pre-defined port.

Both the approver and assessor have pre-defined WSDL files, defining their physical ports, message formats and available web methods that can be invoked by involved partners.

Loan Approval Process and Partners

Partners and physical ports

The following XML fragment from WSDL of the process defines two types of partner links, their roles and references to port types used for communication.

  1.  <plnk:partnerLinkType name="loanApprovalLinkType">
  2.  <plnk:role name="approver">
  3.       <plnk:portType name="apns:loanApprovalPT"/>
  4.    </plnk:role>  
  5.   </plnk:partnerLinkType>
  6.  
  7.  <plnk:partnerLinkType name="riskAssessmentLinkType">
  8.     <plnk:role name="assessor">
  9.      <plnk:portType name="asns:riskAssessmentPT"/>
  10.     </plnk:role>  
  11.   </plnk:partnerLinkType>
  12.  

SOAP Operations

Possible SOAP messages involved in the process includes:

- A request from the customer for a loan

- A call to the assessor ‘check’ web method

- A reply from the assessor

- A call to the approver ‘approve’ web method

- A reply from the approver

- A response from the process to the customer

Process Flow

The process itself is defined as follows

  1.  
  2. <process name="loanApprovalProcess"
  3.          targetNamespace="http://acme.com/loanprocessing"
  4.          suppressJoinFailure="yes"
  5.          xmlns:lns="http://loans.org/wsdl/loan-approval"
  6.  
  7.   <variables>
  8.     <variable name="request"
  9.               messageType="loandef:creditInformationMessage"/>
  10.     <variable name="riskAssessment"
  11.               messageType="asns:riskAssessmentMessage"/>
  12.     <variable name="approvalInfo"
  13.               messageType="apns:approvalMessage"/>
  14.     <variable name="error"
  15.               messageType="loandef:loanRequestErrorMessage"/>
  16.   </variables>
  17.  
  18.   <partnerLinks>
  19.     <partnerLink name="customer"
  20.                  partnerLinkType="lns:loanApprovalLinkType"
  21.                  myRole="approver"/>
  22.     <partnerLink name="approver"
  23.                  partnerLinkType="lns:loanApprovalLinkType"
  24.                  partnerRole="approver"/>
  25.     <partnerLink name="assessor"
  26.                  partnerLinkType="lns:riskAssessmentLinkType"
  27.                  partnerRole="assessor"/>
  28.   </partnerLinks>
  29.  
  30.   <faultHandlers>
  31.     <catch faultName="lns:loanProcessFault"
  32.            faultVariable="error">
  33.       <reply partnerLink="customer"
  34.              portType="apns:loanApprovalPT"
  35.              operation="approve"
  36.              variable="error"
  37.              faultName="invalidRequest"/>
  38.     </catch>
  39.   </faultHandlers>
  40.  
  41.   <flow>
  42.     <links>
  43.       <link name="receive-to-assess"/>
  44.       <link name="receive-to-approval"/>
  45.       <link name="approval-to-reply"/>
  46.       <link name="assess-to-setMessage"/>
  47.       <link name="setMessage-to-reply"/>
  48.       <link name="assess-to-approval"/>
  49.  
  50.     </links>
  51.  
  52.     <receive name="receive1" partnerLink="customer"
  53.              portType="apns:loanApprovalPT"
  54.              operation="approve" variable="request"
  55.              createInstance="yes">
  56.       <source linkName="receive-to-assess"
  57.               transitionCondition="bpws:getVariableData(‘request’, ‘amount’)<10000"/>
  58.       <source linkName="receive-to-approval"
  59.               transitionCondition="bpws:getVariableData(‘request’, ‘amount’)>=10000"/>
  60.     </receive>
  61.  
  62.     <invoke name="invokeAssessor" partnerLink="assessor"
  63.            portType="asns:riskAssessmentPT"
  64.            operation="check"
  65.            inputVariable="request"
  66.            outputVariable="riskAssessment">
  67.       <target linkName="receive-to-assess"/>
  68.       <source linkName="assess-to-setMessage"
  69.              transitionCondition="bpws:getVariableData(‘riskAssessment’, ‘risk’)=‘low’"/>
  70.       <source linkName="assess-to-approval"
  71.              transitionCondition="bpws:getVariableData(‘riskAssessment’, ‘risk’)!=‘low’"/>
  72.     </invoke>
  73.  
  74.     <assign name="assign">
  75.       <target linkName="assess-to-setMessage"/>
  76.       <source linkName="setMessage-to-reply"/>
  77.       <copy>
  78.         <from expression="‘yes’"/>
  79.         <to variable="approvalInfo" part="accept"/>
  80.       </copy>
  81.     </assign>
  82.  
  83.     <invoke name="invokeapprover"
  84.            partnerLink="approver" portType="apns:loanApprovalPT"
  85.            operation="approve"
  86.            inputVariable="request"
  87.            outputVariable="approvalInfo">
  88.       <target linkName="receive-to-approval"/>
  89.       <target linkName="assess-to-approval"/>
  90.       <source linkName="approval-to-reply"/>
  91.     </invoke>
  92.  
  93.     <reply name="reply" partnerLink="customer" portType="apns:loanApprovalPT"
  94.           operation="approve" variable="approvalInfo">
  95.       <target linkName="setMessage-to-reply"/>
  96.       <target linkName="approval-to-reply"/>
  97.     </reply>
  98.   </flow>
  99. </process>

Visualizing the process will lead as to the following diagram

Resources

- PowerDesigner homepage: http://www.sybase.com/products/developmentintegration/powerdesigner

- Business Process Management Initiative: http://www.bpmi.org/

- Business Process Modeling Notation: http://www.bpmn.org/


Tags : more-46

This entry was posted on Monday, October 29th, 2007 at 10:18 pm and is filed under Blog, Solutions. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

 

Leave a Reply


 Top