Developing a Simple Asynchronous BPEL Process

Contributed by Sherry Barkodar
Maintained by Irina Filippova
December 2007

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

The process is an echo process, but it is an asynchronous echo, not a synchronous one. 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.

Expected duration: 30 minutes


Content on this page applies to the NetBeans 6.0 IDE


Tutorial Requirements

Before you proceed, make sure you review the requirements in this section.


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 IDE 6.0 Release Notes.

Software Needed for the Tutorial

Before you begin, you need to install the following software on your computer: NetBeans IDE 6.0 with SOA and the GlassFish application server.


Configuring and Starting the GlassFish Application Server

When you install full NetBeans 6.0 download, it includes the GlassFish application server. The NetBeans IDE will automatically start the application server when needed.

To start the GlassFish application server:

  1. If the Services window is not visible, choose Window > Services.
  2. In the Services window, expand the Servers node.
    The Servers node should contain the GlassFish application server subnode. If the GlassFish application server node does not appear, go to To configure the GlassFish Application Server.


  1. Right-click the GlassFish application server node and select Start.
    The Output window displays logging information about the application startup. If the Output window is not visible, choose Window > Output > Output.

    When the message Application server startup complete appears in the Output window, the application server is running.
    Note: If a green arrow badge appears on the GlassFish application server node, the server is running.

Note: Deploying an application to the GlassFish application server will automatically start the server. Thus, you do not have to manually start the application server.

Note: The following procedure shows how to configure the IDE to use an alternate version of the GlassFish V2 application server.

To configure the GlassFish V2 application server:

You might want to use a different version of the application server than the one provided with NetBeans 6.0. For example, you might want to download and install a more current version of the GlassFish V2 application server from the GlassFish Community site.

The following procedure shows how to configure the NetBeans 6.0 IDE to use an alternate version of the GlassFish V2 application server. It assumes that you have downloaded and installed the alternate version of the application server.

  1. In the Services window, 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, select GlassFish V2 from the list.
  3. Click Next.
    The Platform Folder Location page opens.
  4. In the Platform Location field, use the Browse button to navigate to and select the installation location of the application server.

    If you installed the GlassFish application server in the default location, use Table 1 as a guide for locating the installation. Otherwise, navigate to the location where you installed the GlassFish V2 application server.

    Table 1: Default Application Server Installation Directory

    Platform Installing As... SOA Installation Tools Bundle Installation
    Solaris OS
    root /opt/glassfish-v2 /opt/SUNWappserver
    Solaris OS
    user ~/glassfish-v2 ~/SUNWappserver
    Mac OS X N/A /Applications/NetBeans/glassfish-v2b58g /Applications/NetBeans/NetBeans 6.0
    Windows N/A C:\Program Files\glassfish-v2-b58g C:\Sun\AppServer
  5. Select the Register Local Default Domain radio button and click Next.
  6. Enter 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.
  7. Click Finish.


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>SOA.
  3. In the Projects list, select Asynchronous BPEL Process.

    Asynchronous BPEL Process selected

  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.


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:
    • AsynchronousSample.bpel, the BPEL process
    • AsynchronousSample.wsdl, the process web service interface
    • AsynchronousSample.xsd, the schema file.
    • AsynchronousSampleClient.bpel, the test client process.
    • AsynchronousSampleClient.wsdl, the wsdl for the client process
  2. In the Projects window, expand the AsynchronousSampleApplication node. The JBI deployment project contains:
    • Process Files
    • JBI Modules
    • Test

    AsynchronousSample expanded

  3. Double-click the AsynchronousSample.bpel node.
    Notice the following:
    • The Source Editor contains a tab for AsynchronousSample.bpel.
    • The AsynchronousSample diagram is shown in the Design view.
      The Design view is the business processes visual designer. In this view, you can visually model a business process. The BPEL Design tool automatically generates BPEL code that corresponds to the visual design.
    • The Palette of BPEL elements opens to the right of the Source Editor.
    • The Navigator window shows the BPEL logical view of the BPEL process.

    AsynchronousSample.bpel expanded
    Click to enlarge


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


Deploying the project to the Application Server

Notice that a BPEL project is not directly deployable. It must be added 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. Expand AsynchronousSampleApplication > JBI Modules.
    Ensure that AsynchronousSample.jar node is added.

    AsynchronousSample.jar added to Composite Application Project

  2. Right-click the AsynchronousSampleApplication project node, and choose Deploy.
  3. In the Warning dialog box, make sure GlassFish V2 is selected and click OK.
  4. Deployment has succeeded if you see the following message in the Output window:

    Deployment succeeded

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


Testing the AsynchronousSampleApplication

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


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

    NewTestcase0 passed

See Also

Send Us Your Feedback