Chapter 4. Key technologies 75
Create the variable DeliveryReceipt and define it as the message definition of
the same name in BuyerInterface.wsdl. We introduced the Delivery Receipt
document as an example of a message defined and used only within the
scope of the Buyer private executable process. In a real project situation,
many message of this scope would be expected.
6. We will now create the correlation sets. The message properties required for
the CustomerOrder and PurchaseOrder correlation sets are already defined
in the Protocol public abstract process, so we can simply reference them. The
message properties required for the DeliveryReceipt correlation set will need
to be created in this step.
Create the CustomerOrder correlation set and assign it the
CustomerOrderReference message property from ProtocolInterface.wsdl.
Clicking Browse is used to do this rather than New. Repeat this operation to
create the PurchaseOrder correlation set with the PurchaseOrderReference
message property.
Create the DeliveryReceipt correlation set, this time clicking New to create
the message property DeliveryReceiptReference in BuyerInterface.wsdl, as
shown in Figure 4-18.
Figure 4-18 DeliveryReceiptReference message property creation in purchasing
scenario
7. Now that we have created the partner links, variables, and correlation sets
required by the process, the activities can be added to complete the definition
76 Using BPEL Processes in WebSphere Business Integration Server Foundation - Business Process Integration and Supply Chain Solutions
that was shown in Figure 4-17 on page 74 above. Unless noted otherwise,
use of a correlation set is without initiation.
Create the receive activity Receive Purchase Order processing request
with partner link BuyerPrivate, operation processPurchaseOrder, request
variable PurchaseOrder, and correlation set CustomerOrder (with
initiation).
Create the invoke activity Send Purchase Order to Seller with partner link
SellerPublic, operation transferPurchaserOrder, request variable
PurchaseOrder, and correlation set CustomerOrder.
Create the receive activity Wait for Purchase Order Confirmation from
Seller with partner link BuyerPublic, operation
transferPurchaseOrderConfirmation, request variable
PurchaseOrderConfirmation, and correlation sets CustomerOrder and
PurchaseOrder (with initiation).
Create the receive activity Wait for Delivery Note from Seller with partner
link BuyerPublic, operation transferDeliveryNote, request variable
DeliveryNote, and correlation set PurchaseOrder.
Create the flow.
Create the sequence Match Delivery Note to delivered goods.
Create the invoke activity Send Delivery Note to Goods Receiving with
partner link GoodsReceiving, operation validateDeliveryNote, request
variable DeliveryNote, and correlation set DeliveryReceipt (with initiation).
Create the receive activity Wait for Delivery Receipt from Goods Receiving
with partner link BuyerPrivate, operation acceptDeliveryReceipt, request
variable DeliveryReceipt, and correlation set DeliveryReceipt.
Create the receive activity Wait for Invoice from Seller with partner link
BuyerPublic, operation transferInvoice, request variable Invoice, and
correlation set PurchaseOrder.
Create the invoke activity Send Invoice to Accounts Payable with partner
link AccountsPayable, operation settleInvoice, request variable Invoice,
and correlation set PurchaseOrder.
Create the receive activity Wait for Payment release from Accounts
Payable with partner link BuyerPrivate, operation makePayment, request
variable Payment, and correlation set PurchaseOrder.
Create the invoke activity Send Payment to Seller with partner link
SellerPublic, operation transferPayment, request variable Payment, and
correlation set PurchaseOrder.
When complete, save it. You will be notified of any validation errors.
The source view of the BPEL file for Buyer is shown in Example 4-7.
Chapter 4. Key technologies 77
Example 4-7 Source view of BPEL file for Buyer in purchasing scenario
<?xml version="1.0" encoding="UTF-8"?>
<process expressionLanguage="Java" name="Buyer"
suppressJoinFailure="yes"
targetNamespace="http://www.example.com/process60219238"
wpc:autoDelete="no" wpc:autonomy="peer" wpc:businessRelevant="yes"
wpc:compensationSphere="notSupported" wpc:displayName="Buyer"
wpc:executionMode="longRunning" wpc:validFrom="2003-01-01T00:00:00"
xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
xmlns:wpc="http://www.ibm.com/xmlns/prod/websphere/business-process/v5.1/"
xmlns:wsdl="http://www.example.com/process60219238/interface"
xmlns:wsdl0="http://www.example.com/process60219238"
xmlns:wsdl1="http://www.example.com/process33748449/interface"
xmlns:wsdl2="http://Buyer/GoodsReceiving"
xmlns:wsdl3="http://Buyer/AccountsPayable"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schemas.xmlsoap.org/ws/2003/03/business-process/
http://schemas.xmlsoap.org/ws/2003/03/business-process/">
<partnerLinks>
<partnerLink name="SellerPublic"
partnerLinkType="wsdl0:SellerPublicLT"
partnerRole="SellerPublicRole"/>
<partnerLink myRole="BuyerPublicRole" name="BuyerPublic"
partnerLinkType="wsdl0:BuyerPublicLT"/>
<partnerLink myRole="BuyerPrivateRole" name="BuyerPrivate"
partnerLinkType="wsdl0:BuyerPrivateLT"/>
<partnerLink name="GoodsReceiving"
partnerLinkType="wsdl0:GoodsReceivingLT"
partnerRole="GoodsReceivingRole"/>
<partnerLink name="AccountsPayable"
partnerLinkType="wsdl0:AccountsPayableLT"
partnerRole="AccountsPayableRole"/>
</partnerLinks>
<variables>
<variable messageType="wsdl1:PurchaseOrder" name="PurchaseOrder"/>
<variable messageType="wsdl1:PurchaseOrderConfirmation"
name="PurchaseOrderConfirmation"/>
<variable messageType="wsdl1:DeliveryNote" name="DeliveryNote"/>
<variable messageType="wsdl1:Invoice" name="Invoice"/>
<variable messageType="wsdl1:Payment" name="Payment"/>
<variable messageType="wsdl:DeliveryReceipt" name="DeliveryReceipt"/>
</variables>
<correlationSets>
<correlationSet name="CustomerOrder"
properties="wsdl1:CustomerOrderReference"/>
<correlationSet name="PurchaseOrder"
properties="wsdl1:PurchaseOrderReference"/>
78 Using BPEL Processes in WebSphere Business Integration Server Foundation - Business Process Integration and Supply Chain Solutions
<correlationSet name="DeliveryReceipt"
properties="wsdl:DeliveryReceiptReference"/>
</correlationSets>
<scope name="Scope" wpc:businessRelevant="no" wpc:id="21">
<sequence joinCondition="DefinedByJavaCode" name="Sequence"
wpc:displayName="Sequence" wpc:id="1073741825">
<wpc:joinCondition>
<wpc:false/>
</wpc:joinCondition>
<receive createInstance="yes"
name="ReceivePurchaseOrderprocessingrequest"
operation="processPurchaseOrder"
partnerLink="BuyerPrivate" portType="wsdl:BuyerPrivate"
variable="PurchaseOrder"
wpc:displayName="Receive Purchase Order processing request"
wpc:id="2">
<correlations>
<correlation initiate="yes" set="CustomerOrder"/>
</correlations>
</receive>
<invoke inputVariable="PurchaseOrder"
name="SendPurchaseOrdertoSeller"
operation="transferPurchaseOrder"
partnerLink="SellerPublic" portType="wsdl1:SellerPublic"
wpc:displayName="Send Purchase Order to Seller" wpc:id="4">
<correlations>
<correlation initiate="no" pattern="out"
set="CustomerOrder"/>
</correlations>
</invoke>
<receive name="WaitforPurchaseOrderConfirmationfromSeller"
operation="transferPurchaseOrderConfirmation"
partnerLink="BuyerPublic" portType="wsdl1:BuyerPublic"
variable="PurchaseOrderConfirmation"
wpc:displayName="Wait for Purchase Order Confirmation from
Seller" wpc:id="5">
<correlations>
<correlation initiate="no" set="CustomerOrder"/>
<correlation initiate="yes" set="PurchaseOrder"/>
</correlations>
</receive>
<receive name="WaitforDeliveryNotefromSeller"
operation="transferDeliveryNote"
partnerLink="BuyerPublic" portType="wsdl1:BuyerPublic"
variable="DeliveryNote"
wpc:displayName="Wait for Delivery Note from Seller"
wpc:id="6">
<correlations>
<correlation initiate="no" set="PurchaseOrder"/>

Get Using BPEL Processes in WebSphere Business Integration Server Foundation Business Process Integration and Supply Chain Solutions now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.