This documentation is work in progress and will be released with the next WSO2 EI version.
Simulating a Simple Order Approval Process - WSO2 Enterprise Integrator 6.x.x - WSO2 Documentation

All docs This doc
||
Skip to end of metadata
Go to start of metadata

The following tutorial guides you through a scenario to simulate an order approval process using Human Task artifacts. 

Before you begin,

  • Install Oracle Java SE Development Kit (JDK) version 1.8.* and set the JAVA_HOME environment variable.
  • Download the product installer from here, and run the installer.
    Let's call the installation location of your product the <EI_HOME> directory. This is located in a place specific to your OS as shown below:
    OSHome directory
    Mac OS/Library/WSO2/EnterpriseIntegrator/6.5.0
    WindowsC:\Program Files\WSO2\EnterpriseIntegrator\6.5.0\
    Ubuntu/usr/lib/wso2/EnterpriseIntegrator/6.5.0
    CentOS/usr/lib64/EnterpriseIntegrator/6.5.0
  • Select and download the relevant WSO2 Integration Studio ZIP file depending on your operating system from here , and then extract the ZIP file.

This tutorial includes the following sections:

Deploying the BPEL Process

Follow the steps below to import and deploy the BPEL process, which will act as the Callback Endpoint.

  1. Start the Business Process profile of WSO2 EI.

    Open a terminal and execute the following command:

    wso2ei-6.4.0-business-process

    Go to  Start Menu -> Programs -> WSO2 -> Enterprise Integrator 6.4.0 Business Process. This will open a terminal and start the business process profile.

  2. Log in to the Management Console of the Business Process Profile.
  3. Click Main → Manage → Add → BPEL.
  4. Browse and select the <EI_HOME>/samples/business-process/bpel/ClaimsApprovalProcess.zip file and click Upload.
    You view the deployed BPEL Process as shown below.

Creating a Human Task Project

  1. In WSO2 Integration Studio, go to File -> New -> Other and select Human Task Project.
  2. Fill in the following details in the form that appears on the wizard and click Finish.
    • Project Name: humanTaskProject
    • File Name: newfile
    • Task Name: OrderApproval
    • Target Namespace:  www.wso2.org
  3. Once the project is created, you view the Human Task GUI Editor with the sections of your .ht file listed out. 

Creating the Human Task

You need to fill each of the following sections in this wizard to create the Human Task.

Adding Task Properties

Expand the Task Properties panel and do the following:

  1. Change the name of the task.
  2. Add documentation for the task.
  3. Set the priority of the corresponding task. For this field, you can either add an XPath expression or an integer.

Adding the Task Input 

Expand the Task Input panel and add the following Input Data Mappings. To do this, click the + button on the top left side and fill in the required details (i.e., the Element Name, Display Name and Data Type).

The presentation parameters are auto-generated according to the Element Name you provide. To delete an Input Data Mapping, click on the Delete button corresponding to the relevant input.

Adding the Task Output

Expand the Task Output panel and do the following:

  1. To add a new Output Data Mapping, click the + button on the top left side and fill in the required details (i.e., the Element Name, Display Name and Data Type).

    You can skip this since the values required values are available by default.

    The presentation parameters are auto-generated according to the Element Name you provide. To delete an Output Data Mapping, click on the Delete button corresponding to the relevant output. 

  2. Enter http://localhost:9765/services/ClaimServiceCB/ as the Callback Service URL.

    • The values for Callback Service Name, Callback Operation Name and Callback Service URL are properties of the callback WSDL and the values you provide will deal with the callback WSDL file directly.
    • In this scenario, the Callback Service URL is the URL of the BPEL Process. Follow the steps below to get it.
      1. Log in to the Management Console of the Business Process Profile.
      2. Click MainManageServicesList.
      3. Click on the ClaimServiceCB service in the list.
      4. Copy the URL listed under Endpoints, which you need to add as the Callback Service URL in the Human Task.

Adding the Presentation Elements

Expand the Presentation Elements panel and set the Display Name, Display Subject and the Description of the task.

These will be shown as the task info. The presentation parameters of the task are auto-generated according to the inputs and outputs.

Adding People Assignments 

In this section, select Role and enter admin as the role.

In this section, you can assign different users or roles as different stakeholders to this task. For example, you can add the users with the role name ‘clerk’ as potential owners of this task by filling out the Potential Owners field. If you are assigning a user as an expression you can add it using XPath. The XPath suggestions for the corresponding task will appear when you start entering it in the Expression field.

To add another task, you can select the + button next to the task tab and add a new task. All the tasks can be viewed as tabs on top of the UI. To delete a task, click the X sign on the task tab and delete the task.

Creating the deployable archive

  1. Press Ctrl+S to save the artifacts and their configurations.
  2. Right-click on the project. Select Export Project as a Deployable Archive. The project export dialog box will appear. 
  3. Provide the location you want to save the artifact in and click Finish. This will generate a .zip archive that can be deployed directly in EI-Business Process runtime.

Deploying the Human Task Project

After creating the deployable archive, follow the steps below to deploy them.

  1. Log in to the Management Console of the Business Process Profile.
  2. Navigate to Main →  Manage →  Human Tasks →  Add. 
  3. Upload the zip file that you just exported. 

Invoking the Service of the Human Task

  1. Log in to the Management Console of the Business Process Profile.
  2. Navigate to Main →  Manage →  Services →  List. 
  3. Click the Try this service link of the OrderApprovalService service.
  4. In the Try It Tool, replace the body of the Request section with the following content and click Send.

    <body>
       <p:OrderApprovalData xmlns:p="www.wso2.org">
          <!--Exactly 1 occurrence-->
          <xsd:orderName xmlns:xsd="www.wso2.org">Pineapples</xsd:orderName>
          <!--Exactly 1 occurrence-->
          <xsd:orderQuantity xmlns:xsd="www.wso2.org">10</xsd:orderQuantity>
       </p:OrderApprovalData>
    </body>


    You view the below response in the Response section.

    This creates a task instance of the Human Task you deployed.

Testing the output

Follow the steps below to test the output.

  1. Log in to the Human Task Explorer using the admin/admin credentials. (https://192.168.1.3:9445/humantask-explorer/)
    You view the created Task under MY TASKS.
  2. Click on the Task and click Start.
  3. Select Approved and then click Complete to approve the order.
  4. Click Yes in the message, which pops up.

    You view the task being approved and completed.
  5. Click MY TASKS → Completed. You view the tasks you completed.
  • No labels