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:
- NetBeans IDE 5.5 with NetBeans Enterprise Pack 5.5 (download)
- In order to complete the deployment steps in this tutorial, you
must have Sun Java System Application Server Platform Edition 9 Update
1. This Application Server is bundled with the NetBeans Enterprise Pack
5.5 download.
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:
- Click the Runtime tab to open the Runtime window.
- In the Runtime window, expand the Servers node.
- If the Servers node already contains a Sun Java System Application Server 9 node, then go to step 5.
- If the Servers node does not contain a Sun Java System Application Server 9 node, then do the following to add an application server:
- Right-click the Servers node and choose Add Server from the pop-up menu.
The Add Server Instance dialog box opens.
- In the Choose Server page, from the Server drop-down list, select Sun Java System Application Server.
- (Optional) In the Name field, accept the default value or type the name you want to use to identify the server in the IDE.
- Click Next.
The Platform Location Folder page opens.
- 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.
- Select the Register Local Default Domain option.
- Click Next.
- 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.
- Click Finish.
- 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.
- 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.

Click to enlarge
top
Opening the AsynchronousSample Project
- From the IDE's main menu, choose File >New Project.
The New Project wizard opens.
- In the Categories list, select Samples>Service Oriented Architecture.
- In the Projects list, select Asynchronous BPEL Process.

Click to enlarge
- Click Next.
- In the Project Name field, type AsynchronousSample.
- (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.
- 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
- 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
- In the Projects window, expand the AsynchronousSampleApplication node. The JBI deployment project contains:
- Source Packages
- JBI Modules
- Test
- 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.

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.
- 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.

- Double-click the receiveCallback receive activity in the AsynchronousSampleClient process.
The Property Editor for receiveCallback opens.
- 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.

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.
- Under the Project tab, right-click the AsynchronousSampleApplication deployment project node and choose Add JBI Module.
The Select Project wizard appears.
- In the wizard, select AsynchronousSample.

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

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

- If the Output window is not visible, choose Window > Output.
top
Testing the AsynchronousSampleApplication
- 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.

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

top
Copyright and Trademark Notice