This example demonstrates how to invoke different web services
by selecting alternate WSDLs at runtime.

Two departments in the same company—Sales and Travel—have
workflows that they use to update project names. In this simplified
example, these workflows provide identical web services to gather
the data, TheName. While individual FileNet® workflows could be developed
with a specific partner link to invoke each of these web services,
it is more efficient for the company to have a single workflow for
updating project names, then let the user choose the appropriate department—the
target WSDL—at runtime.
In this example, the SubmitName workflow can invoke
the web service UpdateName in one of two locations
so this example uses two separate FileNet workflow
environments to represent the two departments.
NOTE The names of the workflows must be identical
because they are part of the target namespace for the WSDL, as well
as the target namespace for the schema. In addition, the operation
name, input and output parameters, correlation sets, and fault definitions
must be identical.
You create the UpdateName workflow definition
that provides the web services on one system (either Sales or Travel),
and transfer it on both systems.
You create the SubmitName workflow definition
with a single partner link to invoke UpdateName on one of the systems.
- In SubmitName, you specify data
fields to contain each of the alternate WSDL URLs.
- At the Launch step, the user chooses the target department (Sales
or Travel), which determines which step executes next (AssignSales or AssignTravel).
- In the AssignSales or AssignTravel steps, the appropriate
WSDL URL is assigned to the UseThisEndpoint data field.
- In the AssignInvoke system step, the
Assign system function inserts the UseThisEndpoint data into the
header of the outgoing message that will be used at the Invoke system
function. This determines which UpdateName workflow will be invoked.
Create UpdateName workflow definition
- On the Sales system in Process Designer, open the Workflow Properties >> General tab.
Workflow name and subject: UpdateName
- Define the Web Service on the Web
Services >> Partner Links tab.
- Partner Link Name: ChgName
- Select Receive/Reply and clear Invoke.
- Process Port Type: ChgNamePort
TIP Click Receive/Reply in the Type field to update the data. A new
blank line will display in the Partner Links table.
- From the Web Services Palette, drag a Receive step
to the workflow map.
NOTE
The Receive step must be the first step after the Launch step in order
to launch this workflow automatically.
- Step name: RecUpdate In the Properties pane,
select the Partner Link for this Web Service (ChgName)
- Operation: ChgNameOp
- Select Parameters message type.
- Under Operation Parameters, specify the required input fields:
Table 1. Operation parametersName |
Type |
Field Name |
TheName |
String |
(Create) TheName |
UseThisEndpoint |
String |
(Create) UseThisEndpoint (This field allows
us to confirm which WSDL URL was used to invoke the web service.) |
- From the BPM step palette, drag an Activity step
to the workflow map. This step allows you to look at the data fields
and confirm that the appropriate Receive step executed.
- Step name: LastSales
- Participant: Choose a specific user (you can assign it to yourself).
NOTE Do not
assign F_Originator for any step in this workflow because this workflow
will be launched by the system.
- Parameters: TheName and UseThisEndpoint.
- Add the routes from Launch step to RecUpdate, and from RecUpdate to LastSales.
- Validate, save, and transfer this workflow definition to the workflow
system database.
TIP Save UpdateName workflow definition
to your local file system so that you can access it from another FileNet P8 system that might
not be configured to use the same object store.
- On the Travel system —a different FileNet P8 system or different isolated region—start
Process Designer and open UpdateName workflow definition
from either the object store or your local file system.
- Select the Activity step (LastSales).
- Check that the participant assigned for this step is valid in
the current system. If not, change the participant to a valid user
- Change the name of the step to LastTravel.
NOTE Do not change the name of the workflow
definition (Workflow Properties), the partner link, any parameters
of the Receive step, or the data fields.
- Validate, save, and transfer this workflow definition.
You now have the same workflow definition/web
service in the Sales workflow environment and the Travel workflow
environment.
Create
SubmitName workflow definition
- On the Travel system, create a new workflow definition.
- Open the Workflow Properties >> General tab.
Workflow name and Subject: SubmitName
- Define the Web Services on the Web
Services >> Partner Links tab .
- Partner Link Name: InvokeUpdate
- With Invoke selected, 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 UpdateName, then click OK.
- On the Partner Links tab, select the Port Type (ChgNamePort).
TIP Click Invoke in the Type field
to update the data. A new blank line will display in the Partner Links
table.
- On the Workflow Properties >> Data
Fields tab, create two fields that will hold the WSDL URLs that
correspond to the departments that the user can select at runtime.
WSDL_Sales (string)
WSDL_Travel (string)
- On the Web Services >> Partner Links tab,
copy the WSDL URL and paste it between the double-quotes the Expression
field for data field WSDL_Travel on the Data Fields
tab.
Note that we do not yet have the value
for WSDL_Sales—we will obtain it
when we finish defining this workflow.
- From the BPM step palette, drag an Activity step to the workflow
map and name it AssignSales.
- Drag another Activity step to the workflow map and name it AssignTravel. Note that we are
not specifying a participant for either of these Activity steps— they
will be performed by the system.
- From the General palette, drag a System step to the workflow map
and name it AssignInvoke.
- From the list of system functions, move Assign and Invoke to the right column. (Assign must be before Invoke.)
- Under Selected Functions, double-click Invoke. In the Properties pane,
select the Partner Link InvokeUpdate and Operation ChgNameOp.
- Select Parameters and specify
the required fields.
Table 2. Required
parametersName |
Type |
Field Name |
TheName |
String |
(Create) TheName |
UseThisEndpoint |
String |
(Create) UseThisEndpoint |
- Under Selected functions, double-click Assign.
- In the Assign dialog box, enter a name (temp)—we will replace it later—then
click in the Expression field and click Expression
Builder.
- In Expression Builder, select Partner
Links from the list, and choose InvokeUpdate. The message header
displays in Header Information.
Click Insert to insert it into the Expression
area.
- Edit this header as follows:
- Click OK to close the Expression
Builder.
- In the Assign dialog box, paste F_EndPointRefInvokeUpdate into
the Name field (replacing temp) in Assignment Parameters.
(Delete the trailing =.)
- Select the Launch step.
- Parameters: TheName
- On the Routing tab, enter two Response options: Sales and Travel.
- Create the routes from the Launch step to the AssignSales step, and from Launch to the AssignTravel step.
- Select the route to AssignSales, and specify a routing
condition based on the response: All Sales.
- Select the route to AssignTravel, and specify a routing
condition based on the response: All Travel.
- Select the AssignSales step.
On the Assignments tab, select either Before Execution or After Completion (it doesn't matter which
one because this task is performed by the system), then specify the
following field assignment:
Name: UseThisEndpoint Expression: WSDL_Sales
- Select the AssignTravel step.
On the Assignments tab, use the same procedure
to specify the following field assignment:
Name: UseThisEndpoint Expression: WSDL_Travel
- From the BPM step palette, drag an Activity step
to the workflow map so that you can view the data.
- Step name: UpdateLast
- Participant: F_Originator
- Parameters: TheName, WSDL_Sales, WSDL_Travel,
and UseThisEndpoint
- Add routes between steps:
from
the AssignSales step to the AssignInvoke step
from the AssignTravel step to the AssignInvoke step
from the AssignInvoke step to the UpdateLast step.
- Validate and save this workflow definition, then exit Process
Designer.
At this point, we have stored the WSDL URL for UpdateName (on Travel system)
in the WSDL_Travel data field. Now we
will return to the Sales system to get the WSDL URL for UpdateName on the Sales system.
- On the Sales system, start Process Designer and open the SubmitName workflow definition.
- On Workflow Properties >> Web Services
>> Partner Links tab, select InvokeUpdate, then click Web Services explorer.
- Select Web Services workflows,
then click Execute to display transferred
workflow definitions with a Receive step.
- Select UpdateName, then copy the contents
of the WSDL URL field to the clipboard. (It is helpful to expand the
window to see the entire field.)
- Click Cancel to close the dialog
box without changing the WSDL URL defined for the partner link.
- On the Data Fields tab, paste the WSDL URL into the Expression
field for WSDL_Sales.
We now have both WSDL URLs—WSDL_Sales and WSDL_Travel.
- Validate and save the workflow definition.
Run
the alternate WSDL example
- Launch the SubmitName workflow.
- In the Launch step, enter a string in TheName—maybe something to remind
you which WSDL you selected.
Select a response—Sales or Travel—to specify which web service
to invoke.
Launch the workflow.
- In Workplace Tasks, wait until SubmitLast appears in your Inbox.
If you selected the Sales response in the Launch step, you will also
see LastSales in your list of tasks.
Otherwise, if you selected the Travel response, you must log on to
the Travel system to see LastTravel in your list of tasks.
In addition to being able to specify an alternate WSDL at
runtime, you can use essentially the same procedure as above to assign
an alternate processing endpoint—final soap address. 
In the
header message of the partner link, you replace OPTIONAL_FINAL_SOAP_ADDRESS
with a data field containing the address, then insert the double quotation
marks (") to make the message a valid string expression as in step
9 above.