This example outlines the steps to create a pair of workflows
that use Web Services to provide interaction between the two separate
processes in the same isolated region.
For the simple data used in this example, we can use workflow
parameters.
Table 1. Interaction
between Invoke and Receive workflowsWorkflow diagram |
Details |
 |
A simplified expense approval process illustrates the interaction
between the two workflows:
|
Create the ApproveExpenses workflow
to receive a Web Service request
Tip: We create the
workflow with a Receive step first because the Receive Web Service
defines the parameters and WSDL of the service.
- In Process Designer, start a new workflow definition.
- On the Workflow Properties >> General tab,
provide a name and subject for the new workflow definition (ApproveExpenses).
- Define the Web Service.
- In Workflow Properties >> Web Services,
on the General tab specify a folder
on your object store where incoming attachments (the expense report)
will be stored.
- Be sure that Finalize existing web
services is not selected.
We want
to be able to modify the web service input and output parameters as
many times as we want.
- On the Partner Links tab, enter
a name (ApproveExp) for the Web Service,
then select Receive/Reply.
- In Process Port Type , enter
a name (ExpPort) for the port.
TIP Click Receive/Reply in the Type field to update the data. A new
blank line will display in the Partner Links table.
- In Workflow Properties >> Data Fields,
specify a data field, ReplyMsg (string), that will
be used to hold the reply message.
We will
create other data fields and an attachment automatically as we define
the parameters for the Web Services.
- From the Web Services step palette, drag a Receive step to the
workflow map and specify the properties as follows.
NOTE The Receive
step must be the first step after the Launch step in order to launch
this workflow automatically in response to an invoke of this Web Service.
- In the Properties pane, select the Partner Link for this Web Service
(ApproveExp)
- For Operation, enter a name (ExpOp).
- Select Parameters, specify each
input parameter, and automatically create the corresponding data fields
and attachment.
Note that you can also
create the data fields in the usual way in Workflow Properties >>
Data Fields, and the field names do not need to match the parameter
names.
Table 2. Parameter informationParameter Name |
Type |
Data field |
EmpName |
String |
<Create> EmpName |
TotalAmount |
Float |
<Create> TotalAmount |
ExpenseRpt |
Attachment by Value (This means that the actual file will be attached
to the message, not referenced in an object store. We could use either
option in this workflow since both workflows are in the same isolated
region and have access to the same object store.)
|
<Create> ExpenseRpt |
- From the BPM step palette, drag an Activity step
to the workflow map and name it Review. At this step, a Reviewer
of expense reports checks the attached expense report
and enters a reply message.
- From the Web Services step palette, place a Reply step on the workflow map, and define
the parameters.
- In the Properties pane, select the same partner link and operation
you defined in the Receive step (ApproveExp).
- Under Message Type, select Message.
- Specify the parameter for the reply message.
Table 3. Reply parameterParameter Name |
Type |
Data field |
ReplyParam |
String |
EmpName+ReplyMsg |
- Add routes between the steps.
- Validate, save, and transfer this workflow definition.
Create the SubmitExpenses workflow
that invokes the Web Service
- Start a new workflow definition.
- On the Workflow Properties >> General tab,
provide a name and subject for the workflow definition (SubmitExpenses).
- Define the Web Services.
- On the Web Services >> Partner Links tab,
enter a name (SubmitExp) for the Partner Link.
- Select Invoke and 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 workflow system.
- Select ApproveExpenses and click OK.
- On the Partner Links tab, note the Port (ExpPort).
TIP Click Invoke in the Type field
to update the data. A new blank line will display in the Partner Links
table.
- Close Workflow Properties.
- From the Web Services step palette, drag an Invoke step to the
workflow map.
- In the Properties pane, select the Partner Link for this Web Service
(SubmitExp)
- Select the operation (ExpOp).
Process Designer displays the outgoing parameters
(input required for the invoked service) and incoming parameters (reply
from the service) from the WSDL.
- Select the Invoke step on the workflow map. In the Properties
pane under Outgoing Parameters, create the data fields that will be
parameters in the invoke message to the Web Service. (In this example,
we have accepted the same names as the parameters; you can specify
any data field names.)
Table 4. Outgoing parametersParameter |
Type |
Data field |
EmpName |
String |
EmpName |
TotalAmount |
Float |
TotalAmount |
ExpenseRpt |
Attachment |
ExpenseRpt |
- For Incoming Parameters, create the data field in this workflow
that will contain the reply message from the Receive workflow.
Table 5. Incoming parametersParameter Name |
Type |
Data field |
ReplyParam |
string |
ReplyParam |
- From the BPM step palette, drag an Activity step to the workflow
map so that you can view the Reply message. Place this step after
the Invoke step.
- Name the step Answer.
- Assign Workflow Group F_Originator (the user who submits
the request) as the participant for this step.
- Specify ReplyParam as a parameters for
this step.
- Select the Launch step, and specify EmpName, TotalAmount, and ExpenseRpt as parameters. The
Launch user will supply these values to submit the expense report.
- Add the routes between the steps.
- Validate, save, and launch this workflow.
- In the Launch step, enter appropriate values for data fields EmpName, TotalAmount, and select an Attachment
target document for ExpenseRpt, then launch the workflow.
- In Workplace >>
Tasks, log on as the Reviewer of the expense reports. In your
Inbox, open the Review step in ApproveExpenses.
- Check the data fields and attachment.
- Be sure to enter some message in the ReplyMsg field -Approved or Rejected or some other message.
- Complete the step.
- Log on as the launch user and open the Answer step in your inbox.
- Check ReplyMsg. It should be what you
entered for the EmpName + ReplyMsg.