English | Japanese

Exercise: Web Service Composition 3

Advanced BPEL Process with Human Tasks

The purpose of this exercise is to learn and practice advanced issues in BPEL processes of composing Web services and Human tasks,which is extended from Web Service Compistion 1 (Basic of Web Service Composition using WS-BPEL).

WS-BPEL is used for decribing Web service composition. However, in the execution of many service-oriented system, there are always human tasks for confirmation and so on. Therefore, BPEL4People is proposed for describe the human workflow as the extension of WS-BPEL. The BPEL4People specification is proposed by IT vendors like IBM and SAP, and standalized by OASIS. Using BPEL4People, human activities can also be described as service.(Refer to WS-BPEL Extension for People).

The input of human task of BPEL process is shown to the human who is in charge of the task. The output of human taks is directly inputed by human.

In the former exercises, we mainly provide exercises that only use language services for BPEL processes. However, human tasks should also be considered in the process to adjust the quality of language services in the real world. Therefore, in this exercise we consider the scenario in which human checks and correct the result of machine translation. Through this exercise, students can learn and practice how to create human tasks in the BPEL processes.

Refer to Exercise: Web Service Composition 1 for the appoach of creating BPEL processes.

Practice of BPEL Process with Human Tasks

1.Project Preparation

  • Open the created project in「Exercise: Web Service Composition 1」.
    • If you start from this exercise, please download the project from here, and extract the file. Then, select File->Import, and select "Existing Projects into Workspace" to import the downloaded file.
  

2.Add Human Task

Since the Eclipse BPEL Designer does not provide the visualized environment for human task, we edit "Backtrans.bpel" in the text editor. To add human task, the following items should be edited in the BPEL process:(1)add the namespaces for human tasks,(2)declare the usage of extention functions and define humanInteraction,(3)define human tasks.

We will use the example of composing translation service and human task for checking translation result to describe the above operations.

  • In "Backtrans.bpel", add the following namespaces (in red font) as the properties of <bpws:process> tag.
  • Added BPEL namespaces
    <bpws:process exitOnStandardFault="yes" name="Backtrans"
        suppressJoinFailure="yes"
        targetNamespace="http://www.ai.soc.i.kyoto-u.ac.jp/process/Backtrans/"
        xmlns:b4p="http://www.example.org/BPEL4People"
        xmlns:htd="http://www.example.org/WS-HT"
        xmlns:bpws="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
        xmlns:ns="http://www.ai.soc.i.kyoto-u.ac.jp/process/Backtrans/Artifacts"
        xmlns:ns0="http://langrid.ai.soc.i.kyoto-u.ac.jp/langrid-service_1_2/services/JServer"
        xmlns:tns="http://www.ai.soc.i.kyoto-u.ac.jp/process/Backtrans/">
    
  • Add "b4p:humanInteractions" tag and "bpws:extensions" tag as the first element and the second element of <bpws:process> tag. The added parts are shown in red font as follows, which describe the declaration of the usage of extension functions and the user groups that execute the human task.
  • Delaration of the extension functions, and the definition of humanInteraction
    <bpws:process ... >
       <b4p:humanInteractions>
          <htd:logicalPeopleGroups>
             <htd:logicalPeopleGroup name="HumanTranslator"/>
          </htd:logicalPeopleGroups>
          <htd:tasks/>
          <htd:notifications/>
       </b4p:humanInteractions>
       <bpws:extensions>
          <bpws:extension mustUnderstand="yes" 
                namespace="http://www.example.org/BPEL4People"/>
          <bpws:extension mustUnderstand="yes" 
                namespace="http://www.example.org/WS-HT"/>
       </bpws:extensions>
       <bpws:import ...>
    ...
    
  • Replace the second translation service invoke activity (BackwardTranslation) as human task.
    • Delete the second invoke activity (BackwardTranslation).
    • Insert the following contents in the place where the deleted Invoke activity was.
    Definition of human task
       <bpws:extensionActivity>
         <b4p:peopleActivity 
                  inputVariable="translateRequest2" 
                  outputVariable="translateResponse2">
            <wsht:task xmlns:wsht="http://www.example.org/WS-HT" name="TranslationTask">
               <wsht:interface 
      xmlns:ns="http://langrid.ai.soc.i.kyoto-u.ac.jp/langrid-service_1_2/services/JServer" 
                 operation="translate" portType="ns:Translation"/>
               <wsht:peopleAssignments>
                  <wsht:potentialOwners>
                     <wsht:from logicalPeopleGroup="HumanTranslator"></wsht:from>
                  </wsht:potentialOwners>
                  <wsht:businessAdministrators>
                     <wsht:from logicalPeopleGroup="HumanTranslator"></wsht:from>
                  </wsht:businessAdministrators>
               </wsht:peopleAssignments>
               <wsht:presentationElements>
                  <wsht:name></wsht:name>
                  <wsht:subject>Please translate this text.</wsht:subject>
               </wsht:presentationElements>
            </wsht:task>
         </b4p:peopleActivity>
      </bpws:extensionActivity>
    
  

3.Set the deployment information

To deploy the BPEL process with human task, the following operations of deployment information is required:(1)add the namespaces for human task deployment,(2)describe the extension deployment information of human task and user information.

We will use the example of composing translation service and human task for checking translation result to describe how to set the deployment information.

  • In "Backtrans.pdd", add namespaces in the <pdd:process> tag as follows (shown in red font).
  • Added namespaces in pdd
    <pdd:process
     xmlns:bpelns="http://www.ai.soc.i.kyoto-u.ac.jp/process/Backtrans/"
     xmlns:pdd="http://schemas.active-endpoints.com/pdd/2006/08/pdd.xsd" 
     xmlns:aeb4p="http://www.activebpel.org/b4p/2007/10/wshumantask/deployments"
     xmlns:htd="http://www.example.org/WS-HT"
     location="bpel/Backtrans.bpel" name="bpelns:Backtrans"
     platform="opensource">
    
  • Add "pdd:extensions" tag as the last element of the <pdd:process> tag as follows (shown in red font).
    • Set user name (e.g. testuser) in the place of "USERNAME".
    Added contents of "pdd:extensions"
    <pdd:process ...>
    ...
      <pdd:extensions>
        <aeb4p:logicalPeopleGroups>
          <aeb4p:logicalPeopleGroup 
                location="/process/humanInteractions/logicalPeopleGroups" 
                name="HumanTranslator" type="STATIC">
            <htd:organizationalEntity>
              <htd:users>
                <htd:user>USERNAME</htd:user>
              </htd:users>
            </htd:organizationalEntity>
          </aeb4p:logicalPeopleGroup>
        </aeb4p:logicalPeopleGroups>
      </pdd:extensions>
    </pdd:process>
    
  

4.Set the execution engine

In the BPEL process with human tasks, it is required to set users and user groups in the following steps.

  • Add the contens shown below in "CATALINA_HOME/conf/tomcat-users.xml". (CATALINA_HOME : the directory where Tomcat is installed)
    • Add the tags of "role" and "user".
    • Set the user name as the same name in the above step.
    • Restart Tomcat after modifying the file.
    Add Tomcat user
    <?xml version='1.0' encoding='utf-8'?>
    <tomcat-users>
    ...
      <role rolename="testrole"/>
      ...
      <user username="USERNAME" password="PASSWORD" roles="testrole"/>
    ...
    </tomcat-users>
    
  • In the menu of the engine administration page (http://localhost:8080/BpelAdmin/), select "Identify Service" and set the items of "Provider Configuration" as follows.
    • Checke "Enable"
    • Provider Type:XML File
    • File Location on server: ${catalina.home}/conf/tomcat-users.xml
    • Input the user name in "User for Test" of the "Test Current Configuration" tag, and click the "Test Settings" button. If "Test successful" is shown, then the user is set correctly.
  • The deploy steps are the same as those in other exercises(Web Service Composition 1, 2).
  

5.Test

  • The test steps are also the same as those in other exercises(Web Service Composition 1, 2).
    • Select "Active Processes" in the menu of the engine administration page, and select the process in execution. Whether the process is paused in the place of human task can be confirmed.
  • Login the task box.
    • Access http://localhost:8080/aetask/ .
    • Use the user name and password which are set in former steps.
    • After login, the tasks sent from BPEL process can be confirmed.
  • Execute the task.
    • Double click the shown task. Click "Start" button, and then the output of Human Task can be inputed. Click the "Save Data" button below the input area, and select "Complete",then the human task will be finished.
    • After finishing the human task, the execution of BPEL process will be resumed.
  

Try More Language Services

You can practice this exercise using the above steps for more language services provided by participants of the Language Grid. Try the following services as an advanced exercise.

  • Google Translate
    • Copyright: Google, Inc.
    • Supported languages: Refer to Service Profile
    • Operation: String translate (String sourceLang, String targetLang, String source)
      • sourceLang: Source language
      • targetLang: Target language
      • source: Sentence to be translated