A Simple Asynchronous BPEL Process

Last Updated: 14 November 2006
Contributed by Sherry Barkodar, maintained by Alyona Stashkova

This tutorial provides an overview of the sample project, AsynchronousSample, and illustrates deploying, executing and testing an asynchronous BPEL process using the NetBeans Enterprise Pack 5.5 bundle with all the necessary runtimes.

The Process is simple. It is an echo process, but it is an asynchronous echo, not a synchronous echo. A client sends the process a message. The process receives the input message and returns immediately. Then the process asynchronously calls the original client and sends the same message back. An asynchronous process is used when the BPEL process is long-running (takes a long time to compute the result). The results are returned to the client by performing an invocation on the client. In this tutorial, you will use a simple BPEL project called AsynchronousSample and a Composite Application project called AsynchronousSampleApplication. The project includes WSDL and Schema files, a deployment descriptor, and input files for testing. The web service interface for this process is a single asynchronous operation.

Prerequisites

This tutorial assumes that you have some basic knowledge of, or programming experience with, the Java language and platform and the NetBeans IDE.

System Requirements

This tutorial assumes that your system meets the requirements specified in the System Requirements topic of the NetBeans Enterprise Pack 5.5 Release Notes.

Software Needed for the Tutorial

Before you begin, you must install the following software on your computer:

Contents

top


Configuring the Tutorial Environment

Before you can deploy your application, the Sun Java System Application Server and JBI runtime must be configured correctly and running.

To configure the tutorial environment:

  1. Click the Runtime tab to open the Runtime window.
  2. In the Runtime window, expand the Servers node.
  3. If the Servers node already contains a Sun Java System Application Server 9 node, then go to step 5.
  4. If the Servers node does not contain a Sun Java System Application Server 9 node, then do the following to add an application server:
    1. Right-click the Servers node and choose Add Server from the pop-up menu.
      The Add Server Instance dialog box opens.
    2. In the Choose Server page, from the Server drop-down list, select Sun Java System Application Server.
    3. (Optional) In the Name field, accept the default value or type the name you want to use to identify the server in the IDE.
    4. Click Next.
      The Platform Location Folder page opens.
    5. In the Platform Location field, use the Browse button to navigate to and select the Application Server installation location.
      If you accepted the default values during the installation, the location is C:\Sun\Appserver.
    6. Select the Register Local Default Domain option.
    7. Click Next.
    8. Supply the user name and password for the domain's administrator.
      If you accepted the default values during the installation, the user name is admin and the password is adminadmin.
    9. Click Finish.
  5. In the Runtime window, right-click the Sun Java System Application Server 9 node and choose Start.
    If the Start option is not available, the server is already running and you can skip the next step.
  6. Wait until the following message appears in the Output window:
    Application server startup complete.
    When the server is running, the IDE displays a green arrow badge on the Sun Java System Application Server 9 node.

Application Server running
Click to enlarge

top

Opening the AsynchronousSample Project

  1. From the IDE's main menu, choose File >New Project.
    The New Project wizard opens.
  2. In the Categories list, select Samples>Service Oriented Architecture.
  3. In the Projects list, select Asynchronous BPEL Process.

    Asynchronous BPEL Process selected
    Click to enlarge

  4. Click Next.
  5. In the Project Name field, type AsynchronousSample.

    Typing project name

  6. (Optional) In the Project Location field, use the Browse button to navigate to and select a different folder where the IDE will store the project files.
  7. Click Finish.
    The Projects window now contains two project nodes: one for a BPEL project called AsynchronousSample, and one for a Composite application project called AsynchronousSampleApplication.
    Notice a broken reference in the AsynchronousSampleApplication node. This is normal behavior. The Composite Application has a dependency on JBI Module.
    You can resolve the broken reference later in the Deploying the project to the Application Server section .

top


Exploring the BPEL and JBI Project in the Projects Window

  1. In the Projects window, expand the AsynchronousSample node, then expand the Process Files node.
    The Process Files node contains these items:
  2. In the Projects window, expand the AsynchronousSampleApplication node. The JBI deployment project contains:

    AsynchronousSample expanded

  3. Double-click the AsynchronousSample.bpel node.
    Notice the following:

    AsynchronousSample.bpel expanded
    Click to enlarge

top


Exploring the AsynchronousSampleClient in the Projects Window

The AsynchronousSample project is an asynchronous BPEL process. Testing an asynchronous process requires a client that is capable of receiving an asynchronous callback. Therefore, the project also contains an AsynchronousSampleClient BPEL process. The sole purpose of the AsynchronousSampleClient process is to facilitate the unit testing of the AsynchronousSample.

  1. Double-click the AsynchronousSampleClient.bpel node.
    The IDE displays the AsynchronousSampleClient diagram in the Design view.
    Notice that AsynchronousSample ( partnerLinkB ) does an invocation back on AsynchronousSampleClient to return the response.

    AsynchronousSampleClient diagram

  2. Double-click the receiveCallback receive activity in the AsynchronousSampleClient process.
    The Property Editor for receiveCallback opens.
  3. Click the Correlations tab, select correlator row and click Edit.
    The Edit Correlation Set Editor appears.
    Notice how correlation is used to correlate this response to the correct instance of AsynchronousSampleClient.

Edit Correlation Set Editor

top


Deploying the project to the Application Server

A BPEL project is not directly deployable. You must add a BPEL project as a JBI module to a Composite Application project. Then you can deploy the Composite Application project.  Deploying the project makes the service assembly available to the application server, thus allowing its service units to be run.

  1. Under the Project tab, right-click the AsynchronousSampleApplication deployment project node and choose Add JBI Module.
    The Select Project wizard appears.
  2. In the wizard, select AsynchronousSample.

    Select Project wizard

  3. Click the Add Project JAR Files button.
  4. Expand AsynchronousSampleApplication > JBI Modules.
    Notice AsynchronousSample.jar node is added.

    AsynchronousSample.jar added

  5. Right-click the AsynchronousSampleApplication project node, and choose Deploy Project.
  6. In the Warning dialog box, make sure Sun Java System Application Server 9 is selected and click OK.
  7. Deployment has succeeded if you see the following message in the Output window:

    Deployment succeeded

  8. If the Output window is not visible, choose Window > Output.

top


Testing the AsynchronousSampleApplication

  1. In the Projects window, expand the AsynchronousSampleApplication > Test > NewTestcase0. The NewTestcase0 node contains two XML files: Each time the test is run, the current output is compared to the content of Output.xml.

    NewTestcase0

  2. Right-click the AsynchronousSampleApplication project node, and choose Test Project from the context menu.
    The following message appears in the Output window:

    NewTestcase0 passed

top


Copyright and Trademark Notice