English | Japanese

Exercise: Web Service Composition 2

Exception Handling in Web Service Composition

The purpose of this exercise is to learn exception handling in Web service composition, by extending the created BPEL process in Exercise: Web Service Composition 1.


In the BPEL process of back translation in the exercise of Web service composition 1, the translation service is invoked twice. However, when invoking the translation service, exceptions might occur. For example, when invoking J-Server translation service, if the translation of English -> German is requested, exception will occur in the J-Server translation service since the language pair of English -> German is not supported. In this exercise, we will learn how to handle such exceptions in BPEL processes when invoking Web services.


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

Practice of Exception Handling

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 Fault Handler

  • Right click "ForwardTranslation" (Invoke) and select "Add Fault Handler".
  • Delete the content of "Fault handler" (Compensate, Rethrow) created by default.
  • Select "Catch", set the "Details" tag as follows.
    • Namespace: http://langrid.ai.soc.i.kyoto-u.ac.jp/langrid-service_1_2/services/JServer
    • Fault Name: UnsupportedLanguagePairException
  • Copy "ForwardTranslation" to the Sequence structure of "Fault handler".
    • Right click "ForwardTranslation" and select "Copy".
    • Select "Sequence" of "Fault handler", right click and select "Paste".
    • Set the name as "ForwardTranslationAlternative".
  • Delet the FaultHandler in "ForwardTranslation" in the Fault handler.
    • Click the "×" in the top right, select the appeared FaultHandler and delete it.
  • Click the new created ForwardTranslationAlternative, change the partner link to the new created one.
    • Set the "Details" tag as follows.
    • PartnerLink
      • Select "Create Global Partner Link".
      • Name of "Partner Link":TranslateAltPL
      • PartnerLinkType:TranslatePLT
      • As for TranslateAltPL, set the "Partner Role" as "translator" in the "Details" tag.
    • Operation: translate
    • Input Variable: translateRequest1
    • Output Variable : translateResponse1
  • Same as above, as for BackwardTranslation, set the Fault handler and its internal handlings.
    • Set Namespace, Fault name the same as above.
    • Copy ForwardTranslationAlternative, set it within the Fault handler.
    • Set the name as BackwardTranslationAlternative.
    • Set the input and output parameters as "translateRequest2" and "translateResponse2".
    The following figure shows the screenshot of back translation BPEL process after defining the exception handling.

3.Deploy Process

  • Download the WSDL of Cross Language WEB-Transer as the alternative translation service.
    • Move it in the wsdl directory.
  • Add the following contents in "catalog.xml".
  • Added contents in the "catalog.xml"
  • Add the following contents in "Backtrans.pdd".
  • Add the following contents in the "pdd:partnerLinks" tag. In the tags of "abp:User" and "abp:CleartextPassword" (the part of "******"), set the temporary ID and password (or the Language Grid user ID and password).

    Added contents in the "pdd:partnerLinks" tag
    <pdd:partnerLink name="TranslateAltPL">
     <pdd:partnerRole endpointReference="static">
        <wsa:ServiceName PortName="Translation">s:KyotoUCLWT</wsa:ServiceName>
          <abp:Authentication direction="out">

    Add the following contents as the element of the "pdd:references" tag.

    Added contents in the "pdd:references" tag
  • Select "Configuration" in the menu of the engine administration page (http://localhost:8080/BpelAdmin/), and uncheck "Validate Input/Output messages against schema".


  • Invoke the language pairs that the J-Server does not support, e.g., English -> German.
  • Select "ActiveProcesses" in the menu of the engine administration page, and select the active process.
    • The process execution result will be shown. Confirm that the exception occured and is catched.