BPEL之贷款审批案例(2)

BPEL之贷款审批案例(2)


我们把该例的业务流程定义拷在下面,进行说明:
<process name="loanApprovalProcess"
         targetNamespace="http://acme.com/loanprocessing"
         xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
         xmlns:lns="http://loans.org/wsdl/loan-approval"
         suppressJoinFailure="yes">

   <partnerLinks>
      <partnerLink name="customer"
               partnerLinkType="lns:loanPartnerLinkType"
               myRole="loanService"/>
      <partnerLink name="approver"
               partnerLinkType="lns:loanApprovalLinkType"
               partnerRole="approver"/>
      <partnerLink name="assessor"
               partnerLinkType="lns:riskAssessmentLinkType"
               partnerRole="assessor"/>
   </partnerLinks>

   <variables>
     <variable name="request"
                messageType="lns:creditInformationMessage"/>
     <variable name="risk"
                messageType="lns:riskAssessmentMessage"/>
     <variable name="approval"
                messageType="lns:approvalMessage"/>
     <variable name="error"
                messageType="lns:errorMessage"/>
   </variables>

   <faultHandlers>
      <catch faultName="lns:loanProcessFault"
             faultVariable="error">
         <reply   partnerLink="customer"
                  portType="lns:loanServicePT"
                  operation="request"
                  variable="error"
                  faultName="unableToHandleRequest"/>
      </catch>
   </faultHandlers>
                                                                 

   <flow>
      H:<flow>指明一组步骤应该并行地执行;在并行地执行的一组活动中,您可以通过使用链接(link)来指明执行顺序方面的约束。

      <links>
         <link name="receive-to-assess"/>
         <link name="receive-to-approval"/>
         <link name="approval-to-reply"/>
         <link name="assess-to-setMessage"/>
         <link name="setMessage-to-reply"/>
         <link name="assess-to-approval"/>
      </links>
     H:流程的每一步称为一个活动。存在以下一些基本活动:
     H:receive等待一条消息来响应由某人从外部进行调用的服务接口的操作
      <receive partnerLink="customer"
               portType="lns:loanServicePT"
               operation="request"
               variable="request" createInstance="yes">
         H:转移及其条件
         <source linkName="receive-to-assess"
            transitionCondition=
              "bpws:getVariableData('request','amount')< 10000"/>         
         <source linkName="receive-to-approval"
            transitionCondition=
              "bpws:getVariableData('request','amount')>=10000"/>
      </receive>
      H:invoke调用某个 Web 服务上的操作
      <invoke  partnerLink="assessor"
               portType="lns:riskAssessmentPT"
               operation="check"
               inputVariable="request" 
               outputVariable="risk">
         <target linkName="receive-to-assess"/>
         <source linkName="assess-to-setMessage"
            transitionCondition=
              "bpws:getVariableData('risk','level')='low'"/>
         <source linkName="assess-to-approval"
            transitionCondition=
              "bpws:getVariableData('risk','level')!='low'"/>
      </invoke>
      H:assign把数据从一个地方复制到另一个地方
      <assign>
         <target linkName="assess-to-setMessage"/>
         <source linkName="setMessage-to-reply"/>
         <copy>
            <from expression="'yes'"/>
            <to variable="approval" part="accept"/>
         </copy>
      </assign>
      H:invoke调用某个 Web 服务上的操作
      <invoke  partnerLink="approver"
               portType="lns:loanApprovalPT"
               operation="approve"
               inputVariable="request"
               outputVariable="approval">
         <target linkName="receive-to-approval"/>
         <target linkName="assess-to-approval"/>
         <source linkName="approval-to-reply" />
      </invoke>
      H:reply生成输入/输出操作的响应
      <reply   partnerLink="customer"
               portType="lns:loanServicePT"
               operation="request"
               variable="approval">
         <target linkName="setMessage-to-reply"/>
         <target linkName="approval-to-reply"/>
      </reply>
   </flow>

</process>

 

 

 

 

 

你可能感兴趣的:(Web,活动)