Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This tutorial guides you on how to create a BPEL process to assign a value in the request to the response and echo it using the WSO2 Enterprise Integrator (WSO2 EI) Tooling. It walks you through the steps to demonstrate how you can assign the input string of the request message to the result string of the response message using BPEL Correlation.

...

Table of Contents
maxLevel5
minLevel3

Creating the BPEL Workflow

Create a new BPEL Workflow using the below details.

...

For instructions, see /wiki/spaces/EI6xx/pages/49614443.

Creating the artifacts

Follow the steps below to create the required artifacts.

  1. Right click on the FIX_ME-Add_Business_Logic_Here element, and click Delete to remove it from the default diagram.
  2. Drag and drop an Assign activity to the canvas and place it after the receiveInput activity.

    Tip

    Drag and drop this from the Actions section of the Palette.

  3. Drag and drop an Receive activity to the canvas and place it after the replyOutput activity.
  4. Drag and drop another Assign activity to the canvas and place it after the Receive activity.

  5. Drag and drop a Reply activity to the canvas and place it after the Assign1 activity.
    You view the artifacts you added as shown below. 

Creating the variable

Follow the steps below to create a variable to temporary store the values passed from the request message.

  1. In WSO2 EI Tooling under the EchoCorrelationProcess menu, click the + sign on the Variables panel, to add a new variable and name it tempVar.
  2. Click on the tempVar variable, and click Browse in the Details section of its Properties tab.
  3. Select From Imports under Show XSD Types, select the below Filters, select the string XML Schema under the Matches and click OK.
  4. Click OK in the message, which pops up.

In this scenario, you are using the client Partner Link, which is available by default. Follow the steps to set the Service Role of it.

  1. In the EchoCorrelationProcess menu, click on the client Partner Link.
  2. Click Details in its Properties section and double click process under My Operations.

Configuring the receiveInput activity 

  1. Click on the receiveInput  activity and in the  Details  section of the  Properties  tab, select  client  as the  Partner Link.

  2. Select Process as the Operation.
  3. In the Quick Pick: box, expand the process → EchoAsyncProjectRequestMessage → payload :  EchoAsyncProjectRequest drop down and double click on the process option.

Configuring the Assign activity

  1. Click on the Assign activity, click Details in the Properties tab, and click New.
  2. Click New and in the From: box, expand the  input : EchoCorrelationProcessRequestMessage  drop down and select the  input : string  option. 
  3. In the  To:  box, select tempVar : string.
  4. Press Ctrl+S to save the variable mapping. 
  5. Click New and in the From: box, expand the  input : EchoCorrelationProcessRequestMessage  drop down and select the  input : string  option. 
  6. In the  To:  box, expand the  output : EchoCorrelationProcessResponseMessage  drop down and select the  result : string  option. 

  7. Press Ctrl+S to save the variable mapping.
  8. Click Yes in the message, which pops up to initialize the variables.

  9. Click New and in the From: box, select Expression and enter concat('Instance created with correlationID: ', $tempVar) as the expression.

  10. In the  To:  box, expand the  output : EchoCorrelationProcessResponseMessage  drop down and select the  result : string  option. 
     
  11. Press Ctrl+S to save the variable mapping.

Configuring the replyOutput activity

  1. Click on the replyOutput activity and in the Details section of the Properties tab, select client as the Partner Link.
  2. Keep your cursor on the  Operation  field and double-click on process

  3. Double click process in the Quick Pick section to generate the input and output variables for this element.

Configuring the Receive activity

  1. Click on the Receive  activity and in the  Details  section of the  Properties  tab, select  client  as the  Partner Link .
  2. Keep your cursor on the  Operation  field and double-click on process

  3. Double click  process  in the  Quick Pick  section to generate the input and output variables for this element.


Configuring the Assign1 activity

  1. Click on the Assign1 activity, click Details in the Properties tab, and click New.
  2. Click New, and in the From: box, select  input : EchoCorrelationProcessRequestMessage → payload : EchoCorrelationProcessRequest → input : string

  3. In the To: box, select tempVar : string.
  4. Press Ctrl+S to save the variable mapping.
  5. Click New and in the From: box, expand the  input : EchoCorrelationProcessRequestMessage  drop down and select the  input : string  option. 
  6. In the  To:  box, expand the  output : EchoCorrelationProcessResponseMessage  drop down and select the  result : string  option. 

  7. Press Ctrl+S to save the variable mapping.
  8. Click Yes in the message, which pops up to initialize the variables.
  9. Click New and in the From: box select Expression and enter concat('Correlated response: ', $tempVar).

  10. In the To: box, select result : string.


  11. Press Ctrl+S to save the variable mapping.

Configuring the Reply activity

  1. Click on the Reply activity and in the Details section of the Properties tab, select client as the Partner Link.
  2. Keep your cursor on the  Operation  field and double-click on process 


  3. Double click process in the Quick Pick section to generate the input and output variables for this element.

Creating the Correlation Set

Follow the instructions below to add a correlation to this process.

  1. Click on the receiveInput element.
  2. In WSO2 EI Tooling under the BankLoanProcess menu, click the + sign on the Correlation Sets panel, to add a new correlation.
  3. Select the Correlation Set you created, and click Add in the Details section of its Properties tab.
  4. Click New in the Select a Property window.
  5. Enter id as the Name and click Browse.
  6. Select From Imports under Show XSD Types, select Simple Types and Complex Types under Filter, select the ns1 : string under the Matches and click OK.
  7. Click OK in the message, which pops up the set the prefix of the namespace.

Creating the first Alias of the Correlation Set

  1. Click the New located next to the Aliases label in the Create Message Property window.

    Info

    This maps the Correlation property you created to the matching property of the receiveInput request. This is to act as the alias for correlation.

  2. Select Message Type and click Browse.

  3. Select From Imports under Show XSD Types, select Messages under Filter.

  4. Select EchoCorrelationProcessRequestMessage under Matches, select input : string under Type Structure and click OK.


  5. Click OK in all the subsequent windows.

Mapping the Correlation to the request

  1. Click on the receiveInput element and click Add in the Correlation section of its Properties tab.
  2. Select Yes under the Initiation column for the correlation you added.
  3. Click on the Receive element and click Add in the Correlation section of its Properties tab.
  4. Select No under the Initiation column for the correlation you added.

Setting the ports of the Partner Links for deployment

  1. Double click on the  deploy.xml  file in the  Package Explorer
     
  2. Select the EchoCorrelationProcessPort for the client Partner Link.


Deploying the artifacts

  1. For instructions on creating the deployable artifacts, see /wiki/spaces/EI6xx/pages/49614443.
  2. For instructions on deploying them, see /wiki/spaces/EI6xx/pages/49614443.

Testing the output

  1. In the Management Console of the Business Process profile, click Main → Manage → Processes → List → BPEL, and click on the Process ID of the Bank Loan BPEL process you uploaded.

  2. In the WSDL details section, select client as the Partner Link and click Try It

    You can now invoke it with input values. 

  3. In the Request section of the Try It tool, replace the question mark with the Helloworld text.

  4. Click Send. You view the response in the Response section.
  5. Click Send again. You view the second response in the Response section.