Create the SupplyItems workflow
- Start a new workflow definition that the Supplier uses to respond to inquiries and to process orders.
In Process Designer Workflow Properties >> General tab, identify the workflow definition.
Name: SupplyItems
Subject: SupplyItems
- Define the two Web Services that this workflow will provide.
- On Web Services >> General tab, be sure that Finalize existing web services is not selected.
We will save and transfer this workflow definition more than once to get the Web Services steps defined, and we might need to change the web service parameters.
- On Web Services >> Partner Links, specify a Partner Link for each Web Service that this workflow will provide.
Name: ReceiveInquiry
Invoke: clear this check box
Receive/Reply: select this check box
Process Port Type: RecInquiryPort
Name: ReceiveOrder
Invoke: clear this check box
Receive/Reply: select this check box
Process Port Type: RecOrderPort
- On the XML Schema tab, define two schemas: one for the order entry, and one for the order acknowledgement.
Order entry |
Acknowledgement message |
Name: OrderEntrySchema
Schema Definition : click here for text |
Name: OrderAckSchema
Schema Definition : click here for text |
TIP If the text does not display on separate lines in the schema definition, click Check Well Formed XML.
- On the XML Data Fields tab, specify a field to hold the incoming order message.
Name: XMLOrderField
Schema: OrderEntrySchema
Element: OrderEntry
- Create a step to provide a purchase inquiry Web Service.
From the Web Services Palette, drag a Receive step to the workflow map.
On the Properties >> General tab, enter the following:
Step name: ReceiveInquiry
Partner Link: ReceiveInquiry
Operation: RecInquiryOp
Message Type: Parameters
Operation Parameters:
Name
CustomerName
ItemName |
Type
String
String |
Field Name
<Create> CustomerName
<Create> ItemName |
NOTE The Receive step must be the first step after the Launch step in order to launch this workflow automatically in response to a request in another workflow to invoke this Web Service.
- By examining the XML schemas (Web Services >> XML Schema tab), you can see that you will need the workflow fields listed below to hold the data contained in the incoming and outgoing messages. In addition, we're going to define the other data fields we will need in future steps at this time.
Specify all of the following in Workflow Properties >> Data Fields.
InStock (Boolean)
Shipped (String)
OrderNum (Integer)
Price (Float)
Contact (String)
Address (String)
OrderCompleteMsg (String)
|
- Create a step to represent a process that checks stock and price.
From the BPM Palette, drag an Activity step to the workflow map.
On the Properties >> General tab, enter the following:
Step name: InStock?
Participants: Choose a specific user (you can assign it to yourself) as the participant for the step.
NOTE Do not assign F_Originator for any step in this workflow because this workflow will be launched by the system.
Parameters tab:
CustomerName (read only—from the buyer)
ItemName (read only—from the buyer)
InStock: (read-write—entered by the supplier)
Price: (read-write—entered by the supplier)
OrderNum: (read-write—entered by the supplier)
TIP In this example, you will alternately add an Activity step from the BPM palette, then add a step from the Web Services palette. You might find it useful to copy these steps to MyPalette to minimize switching palettes.
- Create a step to reply with the availability, price, and an order number
to allow tracking of the conversation with the buyer.
From the Web Services Palette, drag a Reply step to the workflow map. On the Properties >> General tab, enter the following:
Name: ReplyStockInfo
Partner Link: ReceiveInquiry
Operation: RecInquiryOp
Message Type: Message
Operation Parameters:
Name
CustomerName
ItemName
InStock
Price
OrderNum
|
Type
String
String
Boolean
Float
Integer
|
Expression
CustomerName
ItemName
InStock
Price
OrderNum |
- From the BPM palette, drag an Activity step to the workflow map. We will use this step to assign the correlation value used to identify a particular incoming message for the Receive step that follows.
Name: AssignF_Corr
Do not specify a participant or queue for this step.
We will return to this step after we define the correlation set in the next step.
- From the Web Services Palette, drag a Receive step to the workflow map.
This step will receive the actual order information if the Buyer decides to continue with the order. (In our example, the Buyer always continues.)
- On the General tab, enter:
Name: ReceiveOrder
Partner Link: ReceiveOrder
Operation: RecOrderOp
Message Type: XML
Incoming XML Data Field: XMLOrderField
Schema: OrderEntrySchema
Element: OrderEntry
- On the Correlation Set tab, specify a name and properties to correlate a specific invoke request (from another workflow) with a corresponding instance of this receive step. We will use a combination of the CustomerName and OrderNum to identify the appropriate incoming message.
Since the incoming message uses XML mode, we must use XPath to specify the correlation data.
Name: OrderCorrelation
Properties/Name: xpathCustomerName
XPath Query String: /*[local-name()="OrderEntry"]/*[local-name()="CustomerName"]
Properties/Name: xpathOrderNum
XPath Query String: /*[local-name()="OrderEntry"]/*[local-name()="OrderNum"]
- Select the AssignF_Corr step. We are using this step to assign the correlation value that will be used to compare with the value specified in the correlation set for the incoming message.
On the Assignments tab, select After Completion. Under Field Assignments, enter the following:
Field name: F_CorrOrderCorrelation
Expression: CustomerName + convert(OrderNum,string)
- Create a step that acknowledges receipt of the order.
- From the Web Services Palette, drag a Reply step to the workflow map.
Step name: ReplyAckOrder
Partner Link: ReceiveOrder
Operation: RecOrderOp
Message Type: Message (be sure to click Message, even if it is already selected)
Schema: OrderAckSchema
Element: OrderAck
- Click the Create Message Template button to display the outgoing message template.
- In the Outgoing Message, edit the variables to supply the appropriate data fields. Note that OrderNum must be converted to a string. The edited Outgoing Message looks like this:
"<OrderAck
xmlns=""http://www.filenet.com/ns/fnpe/2004/06/po/schema/OrderAckSchema"">" + "<CustomerName>" + CustomerName +"</CustomerName>" + "<OrderNum>" + convert(OrderNum,string) + "</OrderNum>" +"</OrderAck>" |
- Create a step to represent the order processing.
From the BPM Palette, drag an Activity step to the workflow map.
Step name: FillOrder
Participants: Choose a specific user (you can assign it to yourself) as the participant for the step.
Parameters tab:
OrderNum
Shipped
- Add routes as shown in the illustration at the beginning of this example.
- Validate, transfer, and add this workflow definition to your object store.
Skip now to Create the OrderItems workflow
in this document. This SupplyItems workflow definition is not complete—it
needs an Invoke step to send an "order shipped" message to the
other workflow, but we cannot create the Invoke step until we define a
web service (a Receive step) in the other workflow.
After you complete the OrderItems workflow, add the remaining steps to the SupplyItems workflow.
- On Workflow Properties >> Web Services >> Partner Links, create the Partner Link for the Web Services that notifies the Buyer that the order was shipped.
Name: InvShip
Invoke: Select this check box
Receive/Reply: Clear this check box
Click Web Services Explorer in WSDL URL.
- In the Web Services Explorer dialog box, select Web Services workflows, then click Execute to display workflows with a Receive system function that have been transferred to Process Engine.
- Select OrderItems, then click OK.
Still on the Partner Links tab, select: Port Type : RecStatusPort
- Create a step to notify the Buyer that the order has been shipped.
This step then waits for a reply from the Buyer indicating that the order was received.
- From the Web Services Palette, place an Invoke step on the workflow map. On the Properties >> General tab, enter the following:
Name: InvShipNotice
Partner Link: InvShip
Operation: RecStatusOp
- Specify the appropriate data fields for the outgoing parameters and incoming parameters.
- Create a step that allows you to verify that the Invoke step completed (it received its reply), and to see the data fields.
From the BPM Palette, drag an Activity step to the workflow map.
Step name: ShipComplete
Participants: Choose a specific user (not F_Originator) as the participant for the step.
Parameters tab:
All data fields
- Validate this workflow definition.
- In Workflow Properties >> Web Services >> General tab, select Finalize existing web services operations.
- Transfer and check in this workflow definition.
- Proceed to Run the workflows.
|