Web Services - alternative WSDL endpoints example

This example demonstrates how to invoke different web services by selecting alternate WSDLs at runtime. See Using Web Services in FileNet workflow for examples of other features.

Authentication diagram

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.

 

Create UpdateName workflow definition

  1. On the Sales system in Process Designer, open the Workflow Properties >> General tab.

    Workflow name and subject: UpdateName

  2. Define the Web Service on the Web Services >> Partner Links tab.
    1. Partner Link Name: ChgName
    2. Select Receive/Reply and clear Invoke.
    3. 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.

  3. 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.

    1. Step name: RecUpdate In the Properties pane, select the Partner Link for this Web Service (ChgName)
    2. Operation: ChgNameOp
    3. Select Parameters message type.
    4. Under Operation Parameters, specify the required input fields:
       
      Name 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.)
  4. 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.
    1. Step name: LastSales
    2. 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.

    3. Parameters: TheName and UseThisEndpoint.
  5. Add the routes from Launch step to RecUpdate, and from RecUpdate to LastSales.
  6. Validate, save, and transfer this workflow definition to the Process Engine 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.

  7. 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.
  8. Select the Activity step (LastSales).
    1. Check that the participant assigned for this step is valid in the current system. If not, change the participant to a valid user
    2. 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.

  9. 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

  1. On the Travel system, create a new workflow definition.
  2. Open the Workflow Properties >> General tab.

    Workflow name and Subject: SubmitName

  3. Define the Web Services on the Web Services >> Partner Links tab .
    1. Partner Link Name: InvokeUpdate
    2. With Invoke selected, click Web Services explorer in WSDL URL.
    3. 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.
    4. Select UpdateName, then click OK.
    5. 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.

  4. 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)

  5. 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.

  6. From the BPM step palette, drag an Activity step to the workflow map and name it AssignSales.
  7. 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.
  8. From the General palette, drag a System step to the workflow map and name it AssignInvoke.
    1. From the list of system functions, move Assign and Invoke to the right column. (Assign must be before Invoke.)
    2. Under Selected Functions, double-click Invoke. In the Properties pane, select the Partner Link InvokeUpdate and Operation ChgNameOp.
    3. Select Parameters and specify the required fields.
       
      Name Type Field Name
      TheName String (Create) TheName
      UseThisEndpoint String (Create) UseThisEndpoint
  9. Under Selected functions, double-click Assign.
    1. In the Assign dialog box, enter a name (temp)—we will replace it later—then click in the Expression field and click Expression Builder.
    2. 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.

      Message header
    3. Edit this header as follows:
      • Cut (to the clipboard) F_EndPointRefInvokeUpdate= from the beginning of the message. We will paste it as the name of the assignment.
      • In the <WSDLEndPoint> element, replace the specific WSDL location with the data field that will contain the selected WSDL location

        <WSDLEndPoint> + UseThisEndpoint + </WSDLEndPoint>

      • To make this message a valid string expression, add double quotes (") at the beginning and end of the message, to each of the existing double quotes, and before and after the inserted field name. The completed message is shown below.
        EndPointRef completed message
    4. Click OK to close the Expression Builder.
    5. In the Assign dialog box, paste F_EndPointRefInvokeUpdate into the Name field (replacing temp) in Assignment Parameters. (Delete the trailing =.)
  10. Select the Launch step.
    1. Parameters: TheName
    2. On the Routing tab, enter two Response options: Sales and Travel.
    3. Create the routes from the Launch step to the AssignSales step, and from Launch to the AssignTravel step.
  11. Select the route to AssignSales, and specify a routing condition based on the response: All Sales.
  12. Select the route to AssignTravel, and specify a routing condition based on the response: All Travel.
  13. 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

  14. Select the AssignTravel step.

    On the Assignments tab, use the same procedure to specify the following field assignment:

         Name: UseThisEndpoint       Expression: WSDL_Travel

  15. From the BPM step palette, drag an Activity step to the workflow map so that you can view the data.
    1. Step name: UpdateLast
    2. Participant: F_Originator
    3. Parameters: TheName, WSDL_Sales, WSDL_Travel, and UseThisEndpoint
  16. 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.

  17. 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.

  18. On the Sales system, start Process Designer and open the SubmitName workflow definition.
  19. On Workflow Properties >> Web Services >> Partner Links tab, select InvokeUpdate, then click Web Services explorer.
    1. Select Web Services workflows, then click Execute to display transferred workflow definitions with a Receive step.
    2. 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.)
    3. Click Cancel to close the dialog box without changing the WSDL URL defined for the partner link.
  20. 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.

  21. Validate and save the workflow definition.

 

Run the alternate WSDL example

  1. Launch the SubmitName workflow.
  2. 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.

  3. 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.

Specify an alternate final soap address

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.

Message header

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 quotes (") to make the message a valid string expression as in step 9 above.