http://www.developer.com/lang/article.php/3799641/Consider-GlassFish-ESB-v2-for-SOA-Tooling.htm
After working through the examples in this article, you should be able to do the following: Confession: I am a pragmatist. I do believe that SOA is more about the design—and not the technology. However, I also believe that if you don't have some tools to implement some of the more complex design patterns for SOA, you are probably wasting a tremendous amount of time, energy, resources, opportunity, and money creating the infrastructure and plumbing that you will need anyway. SOA with tools is not evil. Misuse of tools, or worse, confusing the tool for SOA, is what needs to be avoided. A recent client engagement has involved providing assistance in the design and implementation of a Service Oriented Architecture. The client's core development expertise is primarily with Microsoft .NET technologies, while most of their legacy code runs on a mainframe. Over the last few months, given the prospect of looming budget constraints, and the practical cost barriers that are encountered when scaling commercial SOA vendor products across the enterprise, I've spent quite a bit of time evaluating a number of different Open Source projects for possible consideration as part of the enterprise architecture technology stack. I've been working with the GlassFish Java 5 EE Application Server for the last 18 months—using it primarily to run the Hudson continuous integration engine—and have been extremely pleased with its stability as well as the quality of the admin console. As you can imagine, introducing Open Source tools into any organization can be quite challenging, but an unexpected ally arrived recently which has increased the attractiveness of that option: Budget Reductions. In considering options for implementing an Enterprise Service Bus (ESB), my design principles favor a solution that will allow the creation of a "virtual bus"—without incurring a severe cost penalty for instantiating an instance of the necessary technology stacks on every server; as well as avoiding the hub-and-spoke enterprise architecture integration model. Apache Synape looks promising—and is still under consideration, but the recent GlassFish ESB announcements have drawn my attention: On October 12, 2008, the GlassFish ESB V2 Release Candidate was made available. The General Availability (GA) Build was certified on December 5, 2008, and and Commercial Support for early adopters was made available as of December 23, 2008. A formal launch is planned for sometime in February 2009. Just to be clear: I'm technology neutral. I always take into consideration an organization's existing developer skillsets, the education commitment necessary to introduce new tools and technologies, the long-term maintenance and operational support issues, and the very real nature of limitations of available funding. From GlassFish Getting Started: GlassFish ESB v2 integrates the OpenESB project into the GlassFish Java 5 EE Application Server: The download of GlassFish ESB includes the following bundled components: The following features are available in the basic installation and support modeling a wide variety of SOA design patterns: Another GlassFish project that is beyond the scope of this article, but worth keeping an eye on, is GlassFish Server v3 Prelude: When you consider the cost of scaling an ESB across the enterprise, with many vendors adopting a per CPU pricing strategy, you can quickly find your costs spiraling into the millions of dollars (if you really want to plan for scalability). With budget constraints being a very real factor in how you plan the infrastructure and tooling to support an Enterprise Architecture/Service Oriented Architecture, the simple CPU cost burden of deploying a commercial vendor's ESB strategy will drive many organizations to adopt a centralized ESB at worst, or a hub-and-spoke ESB model at best. The potentially optimum scalability strategy of implementing the ESB technology stack across all servers hosting services is quite often cost-prohibitive for many organizations to consider (using commercial ESB vendor products). This is just one reason you might be interested in Open Source tools such as GlassFish ESB. The vitality of the growth of the OpenESB Project code base is a second factor to consider: Figure 1: OpenESB Source Code Line Count Growth Source: http://fisheye5.cenqua.com/browse/open-esb I'm not saying GlassFish ESB is the right tool for everyone...and indeed, its capabilities might not be a good fit for your requirements. What I am saying is that it is worth consideration as an option. Now, it's time to get started with a hands-on examination. The GlassFish ESB installation is painless and straightforward. It comes bundled with the GlassFish, the Open ESB jars already integrated into the GlassFish installation, as well as the NetBeans IDE. There are a number of different installation packages available for different platforms. At the time of this writing, the following were offered: The first thing you'll need to do is download the GlassFish ESB release that's appropriate for your environment: https://open-esb.dev.java.net/Downloads.html. At the time of this writing, Release Candidate 1 (Stable) was available. For this article, I downloaded the Windows version and installed it under Windows Vista. Figure 2: GlassFish ESB Download File Name Figure 3: GlassFish ESB Installer Launched On the next screen, select the checkbox to accept the license agreement. I chose to accept the following defaults, based on where I have the Java JDK installed. You'll simply need to specify where your JDK is installed. Figure 4: GlassFish ESB Installation - Directory Options You'll want to verify that none of the following port assignments conflict with your existing applications. Figure 5: GlassFish ESB Installation - Port Assignment Options Figure 6: GlassFish ESB Installation - Review Summary Click the Install button to proceed. Setup should now be complete. You will be prompted with the option to register, which is recommended, so that you can stay informed of the latest news from Sun regarding future GlassFish ESB developments. Now, wasn't that easy? Next, I'll launch the NetBeans 6.1 IDE that was just installed.
In Windows, click Start > All Programs. Locate the entry shown in Figure 7 and click it to launch it. Figure 7: Launch NetBeans 6.1 IDE The NetBeans 6.1 IDE should now be running with the information shown in Figure 8 displayed: Figure 8: NetBeans IDE Launched The GlassFish ESB administration functions are integrated into the NetBeans 6.1 IDE. This greatly simplifies the developer's workflow to design, code, and deploy applications. Figure 9: Start GlassFish V2 Now that you have GlassFish ESB and NetBeans IDE installed, you'll quickly touch on the NetBeans IDE user interface that enables you to administer GlassFish configuration and resources from within NetBeans. Now, take a quick tour and see what is under the hood. The nodes shown in Figure 10 should appear under GlassFish V2 in the NetBeans IDE "Services" tab: Figure 10: GlassFish Nodes Clicking the "Applications" node should display the following additional folders: Figure 11: GlassFish Applications Clicking the "Resources" node should display the following additional folders: Figure 12: GlassFish Resources To fit everything neatly into a single screenshot above, I didn't expand the "Connectors" above, so here it is: Figure 13: GlassFish Resources Right-clicking the JVMs node will allow you to explore the various properties and options that are defined in the environment or can be configured through GlassFish ESB. Figure 14: GlassFish JVMs Node Figure 15: GlassFish JVM Options Clicking the "JBI" node should display the following additional folders: Figure 16: GlassFish JBI Because this is an initial install, there are no entries yet under the "Service Assemblies" node. Figure 17: GlassFish JBI Service Assemblies Alternatively, you can manage GlassFish via the Web Admin Console by connecting to port 4848 [default]: Figure 18: GlassFish Web Admin Console Logon Figure 19: GlassFish Web Admin Console In this example, you will create a simple BPEL 2.0 process and deploy it to the GlassFish ESB. Your BPEL process flow for this simple demonstration will take an inbound Trouble Ticket SOAP Request and provide a simple SOAP reply message. You will subsequently expose the BPEL process as a web service and invoke it using the CASA Test Case capabilities. Click File > New Project. Figure 20: NetBeans New Project Menu Select the "SOA" project type, and "BPEL Module". Figure 21: NetBeans New BPEL Project Click "Next". Project Name: CaptureTroubleTickets You can accept the default project location, but in this example, I have modified the directory to simplify the path displayed onscreen. Figure 22: NetBeans New BPEL Project Location Click "Finish". You should see the following in the "Projects" tab. Figure 23: NetBeans New BPEL Project Created A BPEL module interface is defined by a corresponding WSDL definition. To simplify the steps needed to prepare for this example, a prebuilt WSDL file is available for you to download here: TroubleTicket.wsdl. Figure 24: NetBeans > New > Other Figure 25: BPEL WSDL Import - Choose File Type Specify resource location: Figure 26: BPEL WSDL Import - Specify Resource Location Your NetBeans IDE CaptureTroubleTickets project should reflect the successful import of the TroubleTicket.wsdl file under the "Process Files" folder. Figure 27: BPEL WSDL Import - Success In the CaptureTroubleTickets Project view: Figure 28: Create New BPEL Process Figure 29: New BPEL Process - Name and Location Click "Finish".
An empty BPEL Process is now defined within the project. Next, you will customize the BPEL Process Flow. The next few steps will demonstrate how to associate the WSDL that you just imported into the project as a new PartnerLink within the new BPEL process that you just created. As you will note from the next screenshot, I have used arrows to help you locate the slightly shaded area in the NetBeans IDE which is known as the "Partner Lane" in a BPEL Design view. Figure 30: Locate the "Partner Lane" To do this, you will drag-and-drop the TroubleTicket.wsdl file in the CaptureTroubleTicket project in the NetBeans IDE from the Project folder to what is known as the Partner Lane. Note the difference between the screenshot in Figure 31, when the WSDL file is dragged into the "Partner Lane"—but the cursor is not yet hovering over the anchor...versus Figure 32. Figure 31: Dragging WSDL to Partner Lane - Cursor Not Over Anchor In this screenshot, the cursor is over the "Partner Lane" anchor. Figure 32: Dragging WSDL to Partner Lane - Cursor Over Anchor Now, drag-and-drop the TroubleTicket.wsdl file to the "Partner Lane" and release the cursor on top of the anchor. When you release the cursor, you will be prompted with the Create New Partner Link screen (see Figure 33).
Figure 33: Create New Partner Link Click "Ok". You now should see the "Partner Link" icon in the "Partner Lane". Figure 34: New Partner Link Created From the palette displayed in the right-hand corner of the NetBeans IDE, drag-and-drop a "Receive" node into the BPEL Process Flow. Figure 35: Add Receive node Click the "Edit Icon". Figure 36: Receive node Property Editor Click the "Create" button to define a new input variable. Accept the default value by clicking "Ok". Figure 37: Create Receive Input Variable As the red arrow below points out, the Receive node now maps back to the corresponding WSDL operation Figure 38: Receive node Created Next, you drag-and-drop a "Reply" node from the palette to a point just below the "Receive" node. Figure 39: Add Reply node to BPEL Process Modify "Reply" node properties... Figure 40: Modify Reply node Properties Click "Create..." to create a Reply node Output Variable. Figure 41: Create Reply node Output Variable Accept the defaults provided and click "Ok". Click "Ok" to save the modifications to the Reply node's properties. You should now have a BPEL process that looks like the following: Figure 42: BPEL Receive/Reply So, what have you accomplished so far? What's next? For now, you will simply stub out a response value to be returned in the Reply Message. In the interest of brevity for this article, I've left out any interaction with a database or calling another Web Service. Covering all of the features available within the GlassFish ESB is beyond the scope of an article such as this. The intent of this article is to give you enough of an overview to whet your appetite to explore further on your own. There are suggested links provided at the end of this article if you want to explore further. Add the "Assign" node to the BPEL process: Figure 43: Add Assign node to BPEL Process Select the new "Assign" node in the BPEL process and click the "Mapper" menu item Figure 44: BPEL Assign Mapper Select the "String Literal" from the "String" menu and drag it into the middle column. Figure 45: Select Literal String for Mapper assignment Enter a literal value of "TicketSubmitted", and map the literal value to the part1 element of the SubmitTroubleTicketOperationOut message. Figure 46: Map Literal String to Reply message. You now have provided a stubbed out value for the SOAP Reply message to send back to the consumer of the service. A future iteration of this example could be extended to demonstrate accessing a database, invoking another service, or routing a message to a JMS Queue to store a Trouble Ticket as well as generating a unique Trouble Ticket Number to be returned in the SOAP Reply. However, the goal for this article is to simply provide a relatively high-level overview and introduction to the GlassFish ESB. Save and Validate BPEL By clicking the Source tab, your BPEL generated code should look like the following: Figure 47: View BPEL Source Right-click the CaptureTroubleTickets BPEL project root node and select the "Build" menu option (to build a jar file for the project) Figure 48: Map Literal String to Reply message. Within the context of a JBI container, the resulting jar is known as as a "Service Unit"—which is the smallest unit that can be deployed to a JBI container. To deploy the Service Unit jar that was generated in the previous step, you will need to create a CASA project: Figure 49: Create New CASA Project Figure 50: Specify Name and Location for New CASA Project You should now have a screen that looks like this: Figure 51: Specify Name and Location for New CASA Project Next, you add the JBI Module (the CaptureTroubleTickets project) to the CASA project. Figure 52: Add JBI project to the CASA project Confirm that you have successfully added the JBI Module to the CASA project by checking your results with the screenshot in Figure 53. Figure 53: JBI add to CASA completed Figure 54: CASA project build success Take a moment and Right-Click the troubleTicketPort in the WSDL Ports. Click Properties. In particular, note the SOAP Address that is exposed, which can now be invoked by a consumer. Figure 55: CASA SOAP Properties In the Project explorer view, Under the TroubleTicketCASA project, right-click on the folder named "Test". Click "New Test Case". Figure 56: Create New Test Case Accept the default Test Case Name, and then click "Next". Figure 57: New Test Case Name Next, you select the WSDL for the Test Case, and then click "Next". Figure 58: Select WSDL for Test Case Finally, you select the Operation from the WSDL for the Test Case, and then click "Finish". Figure 59: Select the Operation from the WSDL for Test Case Enter the following values for the Test Case data: Click File > Save. Figure 60: Enter Test Case Data You just have a few more steps to complete this demonstration: To deploy the CASA project, right-click the TroubleTicketCASA project icon in the Projects view, and click Deploy. Figure 61: Deploy the CASA Project Now, you are ready to test the Composite Application. Figure 62: Confirm Test Results If you'll check the console output window in NetBeans, you should see something like this, indicating a successful test: This article has barely scratched the service of what is available within the GlassFish ESB and OpenESB projects. There simply are too many capabilities and features that are beyond the scope of an introductory article such as this. However, hopefully you are now intrigued enough to at least consider investigating GlassFish ESB further on your own. There are significant developments underway in the GlassFish project community, and as your SOA/EA efforts may face tighter budget challenges, there is real value to be leveraged by considering the GlassFish Java EE Server and GlassFish ESB project as potential core components within your infrastructure. The excellent integration with NetBeans IDE simply adds to the value proposition. There are some very interesting GlassFish adoption success stories that may help give you a better understanding of the level of serious consideration that has been given to including GlassFish ESB in some recent enterprise architecture efforts. In researching GlassFish ESB for this article, I came across a number of resources that will help you get up-to-speed quickly, and increase your depth of knowledge of the capabilities of the GlassFish application server: Kelvin Meeks is the Founder of International Technology Ventures, Inc., a professional services consulting firm, based out of the Pacific Northwest, that specializes in providing clients with expertise in the design and implementation of high performance distributed Enterprise Architecture systems. Kelvin has worked in the Information Technology field for over 20 years in all phases of software design, development, testing, sales, and project management...from startups to Fortune 500 and Global 2000 firms. Kelvin writes a technology research blog at intltechventures.blogspot.com
Consider GlassFish ESB v2 for SOA Tooling
January 29, 2009
Objectives
Background
What Is GlassFish?
"GlassFish is a free, open source application server which implements the newest features in the Java EE 5 platform (the next version of the J2EE platform). The Java EE 5 platform includes the latest versions of technologies such as Enterprise JavaBeans (EJB) 3.0, JavaServer Faces (JSF) 1.2, Servlet 2.5, JavaServer Pages (JSP) 2.1, Java API for Web Services (JAX-WS) 2.0, Java Architecture for XML Binding (JAXB) 2.0, Java Persistence 1.0, Common Annotations 1.0, Streaming API for XML."
What is GlassFish ESB?
"Project OpenESB implements an Enterprise Service Bus (ESB) runtime using Java Business Integration (JBI) as the foundation, enabling the easy integration of web services to create loosely coupled, enterprise-class composite applications."
BPEL Design Palette includes:
CASA Design Palette includes: Basic Activities:
Structured Activities:
WSDL Bindings:
Other GlassFish Projects
"GlassFish v3 Prelude is the next major release of the GlassFish application server. GlassFish v3 Prelude provides a lightweight and extensible core based on OSGi, a web and scripting container, an easy-to-use Admin Console for configuration and management, and Update Center connectivity."
Why Should You Care?

Reprinted with permission.Installation
Download GlassFish ESB

Launch the installer executable

Click here for a larger image.
Accept License Agreement
Install NetBeans IDE 6.1

Click here for a larger image.
Install GlassFish v2 ur2

Click here for a larger image.
Review Summary

Click here for a larger image.
Configuring GlassFish ESB
Launch NetBeans 6.1 IDE


Click here for a larger image.
Start GlassFish V2

Click here for a larger image.
A Quick Tour






Click here for a larger image.


Web Admin Console

Click here for a larger image.
Note: If, after logging into the Web Admin Console, you happen to see a message indicating Restart Required, use the NetBeans IDE to perform the restart by right-clicking the GlassFish V2 node and selecting "Restart" (so you can avoid the need to open a command prompt and execute the batch scripts).

Click here for a larger image.
Simple BPEL Example: Process Inbound Trouble Ticket
Note: The purpose of this article, and this first example, is to familiarize you with the process and tools, so it will be extremely simplified. This is not intended as an example of a real-life application.
Create New BPEL Process

Click here for a larger image.

Click here for a larger image.
Specify the new BPEL project location

Click here for a larger image.

Create BPEL Module from WSDL

Click here for a larger image.

Click here for a larger image.

Click here for a larger image.

Click here for a larger image.
Create the Trouble Ticket BPEL Process

Click here for a larger image.
Note: The File Name property should be set to SubmitTroubleTicket. You will also note that ".bpel" suffix given to the Created File.

Click here for a larger image.
BPEL Process Flow Design

Click here for a larger image.
Create New Partner Link

Click here for a larger image.

Click here for a larger image.

Click here for a larger image.

Click here for a larger image.
Add A BPEL Receive node

Click here for a larger image.



Click here for a larger image.
Add a BPEL Reply node

Click here for a larger image.



Click here for a larger image.
Map the BPEL Request to the BPEL Reply

Click here for a larger image.

Click here for a larger image.

Click here for a larger image.

Click here for a larger image.

Click here for a larger image.
Build the Service Unit (JAR)

Click here for a larger image.
Create the Composite Application Service Assembly (CASA)

Click here for a larger image.

Click here for a larger image.

Click here for a larger image.

Click here for a larger image.

Click here for a larger image.

Click here for a larger image.

Click here for a larger image.
Create CASA Test Case

Click here for a larger image.

Click here for a larger image.

Click here for a larger image.

Click here for a larger image.

Click here for a larger image.
Deploying and Testing the Composite Application

Click here for a larger image.

Click here for a larger image.
Test TestCase1\Concurrent.properties Passed.
Threads count Success: <1> Error: <0> Not completed: <0>
Conclusion
References
Web Resource Links
Recommended Books for Further Reading
About the Author