Processing an Order in a Purchase Order System
This tutorial demonstrates various features of the HTTP Binding Component while creating a purchase order composite application. The project illustrates how to use the HTTP Binding Component to receive and send SOAP messages over HTTP. For more information about the HTTP Binding Component, see the
https://open-esb.dev.java.net/
.
This tutorial uses the following JBI Components:
- HTTP Binding Component
- BPEL Service Engine
You can download and review the http://www.netbeans.org/files/documents/4/1456/ep-httpbc-tutorial.zip
sample for this tutorial. This is the same project that is created as a result of completing all of the steps in this tutorial.
For more information about working with the NetBeans IDE, see the http://www.netbeans.org/kb/
page on the NetBeans web site.
What you need to know
The following sections provide instructions on how to create, build, and deploy the Purchase Order Project.
- Tutorial Requirements
- Project Overview
- Configuring the Tutorial Environment
What you need to do
To create the tutorial's sample project you do the following
Tutorial Requirements
Before you proceed, make sure that you review the requirements in this section.
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 6.1 Release Notes.
Software Needed for the Tutorials
Before you begin, you need to install the following software on your computer: NetBeans IDE 6.1 with SOA and GlassFish V2. These are included in the GlassFish ESB download
available from https://open-esb.dev.java.net/Downloads.html
Project Overview
The purchase order handling system in this scenario is represented by a web service implemented using GlassFish Application Server with the JBI framework.
Scenario Message Flow
The message flow of the Purchase Order scenario is as follows:
- The web client, using some client-side scripting language such as JavaScript, takes the purchase order information entered into the web form and packages it into a SOAP message. The format of the SOAP message is defined using a WSDL.
- The SOAP message is sent to a web service endpoint hosted by the HTTP Binding Component.
- The HTTP Binding Component transforms the SOAP message into a Normalized Message. The Normalized Message is sent to the Normalized Message Router.
- The Normalized Message Router routes the Normalized Message to the BPEL Service Engine.
- The BPEL Service Engine interprets the purchase order information and properly invokes other BPEL processes to fulfill the request.
- The BPEL Service Engine creates a response message in the form of a Normalized Message. The Normalized Message is sent to the Normalized Message Router.
- The HTTP BC receives the response message and converts it to a SOAP message. The SOAP Message is sent back to the web client as a proper response as defined by the WSDL document.
- The web client takes the response and creates a human-readable HTML page to notify the user that the purchase order was either accepted or rejected.
Duke's Book Store uses an automated purchase order system with an open interface through which anyone can make a purchase. To accomplish this they use the Java Business Integration framework. Each process is implemented using the BPEL language. Every interface is exposed as a WSDL, with SOAP over HTTP as the underlying messaging and transport.
Core System Pieces
The system's core pieces are the PurchaseOrder interface and the Inventory interface.
- The PurchaseOrder interface is defined using a WSDL document and has one operation called sendPurchaseOrder. The PurchaseOrder interface is implemented using one BPEL process exposed through SOAP over HTTP. That means that anyone who can send a SOAP message over HTTP to this service can make a purchase.
- The Inventory interface is defined using a WSDL document and has one operation called isInventoryAvailable. The Inventory interface is implemented using another BPEL process, invoked by the PurchaseOrder service, to determine whether there is sufficient inventory of each book to complete a purchase order. This service is also exposed through SOAP over HTTP. Anyone can make a call to this service, but the main caller of this service is the PurchaseOrder service.
Configuring the Tutorial Environment
Before you can deploy your application, the GlassFish V2 must be configured correctly and running.
To check the status of GlassFish
- If the Services window is not visible, choose Window → Services.
- In the Services window, expand the Servers node.
The Servers node should contain a GlassFish V2 subnode. If an application server node does not appear, go to To configure GlassFish.
If a green arrow badge appears on the GlassFish V2 node, the server is running. If a green arrow badge does not appear, right-click GlassFish and select Start.
- If the Services window is not visible, choose Window → Services.
- 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.
- In the Choose Server page, from the Server drop-down list, select GlassFish V2.
- (Optional) In the Name field, change the default name for the server.
The IDE uses this name to identify the server.
- Click Next.
The Platform Location Folder page appears.
- In the Platform Location field, use the Browse button to navigate to and select the installation location of the application server.
The default installation location is different depending on the type of installation and the platform, as shown in the following table.
| Platform | Installer | SOA Installation | Tools Bundle Installation |
| Solaris OS Linux | root | /opt/SUNWappserver | /opt/SDK |
| Solaris OSLinux | user | ~/SUNWappserver | ~/SDK |
| Mac OS X | N/A | ~/SUNWappserver | ~/SDK |
| Windows | N/A | C:\Sun\AppServer | C:\Sun\SDK |
- Select the Register Local Default Domain radio button and click Next.
- 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.
- Click Finish.
To start GlassFish
- In the Services window, right-click the GlassFish V2 node and choose Start.
- Wait until the following message appears in the Output window:
Startup complete.
When the server is running, the IDE displays a green arrow badge on the GlassFish V2 node.
Next Step Return to GlassFish ESB Documentation Home