26,01 €
Composite applications aid businesses by stitching together various componentized business capabilities. In the current enterprise scenario, empowering business users to react quickly to the rapidly changing business environment is the topmost priority. With the advent of composite applications the 'reuse' paradigm has moved from the technical aspect to the business aspect. You no longer re-use a service. You re-use a business process. Now enterprises can define their own behaviors optimized for their businesses through metadata and flows. This business process composition has become increasingly important for constructing business logic.
The ability of composite applications to share components between them nullifies the distinction between actual applications. Business users should be able to move between the activities they need to do without any actual awareness that they are moving from one domain to another.
The composite application design enables your company to combine multiple heterogeneous technologies into a single application, bringing key application capabilities within reach of your business user. Enterprises creating richer composite applications by leveraging existing interoperable components increase the organization's ability to respond quickly and cost-effectively to emerging business requirements.
While there are many vendors offering various graphical tools to create composite applications, this book focuses on using the BPEL service engine from the OpenESB project for solving business integration problems. Project OpenESB implements an Enterprise Service Bus runtime using Java Business Integration (JBI) as the base. This allows easy integration of web services to create loosely coupled enterprise-class composite applications.
The objective of this book is to help enterprise application architects and developers to understand various SOA tools available as part of the NetBeans IDE that will enable them to build an enterprise-grade, scalable application in a short period using a single development interface. The NetBeans SOA tools form an open-source and freely available add-on to the NetBeans IDE that is targeted for enterprise application development. This pack contains open-sourced features from Sun's Java Studio Enterprise and Java CAPS products, as well as all-new features for creating composite applications, BPEL-based web services, secure Java EE web services, and real-world XML artifacts like XML Schema and WSDL. Part of NetBeans Enterprise Pack is integrated with NetBeans 6.0, so you don't need to download additional add-ons or plug-ins if you are using NetBeans version 6.0 or higher. However, not all OpenESB components are integrated with NetBeans 6.0. For instance you may not be able to create an Intelligent Event Processor using the standard NetBeans IDE; these components can be downloaded and installed into the NetBeans IDE.
This book will help enterprise application architects and developers understand various SOA tools available as part of the NetBeans IDE that will enable them to build an enterprise-grade, scalable application in a short period using a single development interface.
This book introduces basic SOA concepts and shows how you can use NetBeans and OpenESB tools to design and deploy composite applications. After introducing the SOA concepts, you are introduced to various NetBeans Editors and aids that you need to understand and work with for designing a composite application. For example you are introduced to a WSDL editor before dealing with web services. The last part of the book deals with a full-fledged incremental example on how you can build a complex composite application with key screenshots accompanied by the source code available on the website.
This book is for enterprise developers and architects interested in using NetBeans IDE and OpenESB tools to build their SOA based applications.
Sie lesen das E-Book in den Legimi-Apps auf:
Seitenzahl: 246
Veröffentlichungsjahr: 2008
Copyright © 2008 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: February 2008
Production Reference: 1010208
Published by Packt Publishing Ltd.
32 Lincoln Road
Olton
Birmingham, B27 6PA, UK.
ISBN 978-1-847192-62-2
www.packtpub.com
Cover Image by Nilesh R. Mohite (<[email protected]> )
Authors
David Salter
Frank Jennings
Reviewer
Mario Pérez Madueño
Acquisition Editor
Priyanka Baruah
Development Editor
Nikhil Bangera
Technical Editor
Bhupali Khule
Editorial Team Leader
Mithil Kulkarni
Project Manager
Abhijeet Deobhakta
Indexers
Hemangini Bari
Monica Ajmera
Proofreader
Angie Butcher
Production Coordinator
Shantanu Zagade
Cover Work
Shantanu Zagade
David Salter is an enterprise software architect who has been developing software professionally since 1991. His relationship with Java goes right back to the beginning, using Java 1.0 for writing desktop applications and applets for interactive web sites. David has been developing Enterprise Java Applications using both the J2EE standards and open source solutions for the last five years. David runs the Java community web site Develop In Java (http://www.developinjava.com), a web site for all levels of Java developers.
Foremost, I would like to thank my wife and family for putting up with my many hours at the computer whilst writing this book. Special thanks go to my wife for all her encouragement and support.
I'd also like to say thank you to all the people at Packt Publishing, especially Priyanka, Abhijeet, Bhupali, and Patricia. Thanks also go to the NetBeans Enterprise Developer community, who have provided help and assistance throughout the writing of this book.
Frank Jennings works in the Information Products Group of Sun Microsystems Inc. He has more than 9 years of experience in Java, SOA and System Design. He is an Electronics Engineer from Madras University and has worked for several open source projects. Frank has written regular columns for leading Java journals including Java Developer's Journal and Linux Developer's Week. Frank is also the co-author of the book SOA Approach to Integration focusing on SOA design pattern for enterprises. Frank also is involved in the technical publication of Sun Microsystems in the fields of Solaris and Developer AMP Stack. His blog can be read at http://blogs.sun.com/phantom and he can be reached at [email protected]. He also holds a Post Graduate Diploma in Computer Science and an Advance Diploma in Computer Integrated Management from University of Indianapolis.
It is just amazing how the guys at Packt Publishing put up with me inspite of my late drafts. I would like to thank Abhijeet and Bhupali for all their hardwork in making me work to complete this book. I also thank the NetBeans Documentation team for providing an extensive set of tutorials on the SOA capabilities of NetBeans.
Mario Pérez Madueño was born in 1975 in Turin and lives in Barcelona. He graduated in ETIS from the Open University of Catalonia (UOC) in 2006 and is currently finishing studies for the EI degree. He is a foundation member of ARUOC robotics group in the same University. Mario is a Java SE, ME and EE enthusiast and a fan of NetBeans IDE, he is currently contributing with the Spanish translation team for NetBeans 6.
Acknowledgements goes for my wife María, for her unconditional help and support in all the projects I get involved, and to Martín for giving me the force for going ahead.
Composite applications aid businesses by stitching together various componented business capabilities. In the current enterprise scenario, empowering business users to react quickly to the rapidly changing business environment is the top most priority. With the advent of composite applications the 'reuse' paradigm has moved from the technical aspect to the business aspect. You no longer re-use a service but re-use a business process. Now, enterprises can define their own behaviors optimized for their businesses through metadata and flows. This business process composition has become increasingly important for constructing business logic.
The ability of composite applications to share components between them nullifies the distinction between actual applications. Business users should be able to move between the activities they need to do without any actual awareness that they are moving from one domain to another.
The composite application design enables your company to combine multiple heterogeneous technologies into a single application, bringing key application capability within reach of your business user. Enterprises creating richer composite applications by leveraging existing interoperable components increase the development organization's ability to respond quickly and cost-effectively to emerging business requirements. While there are many vendors offering various graphical tools to create composite applications, this book will focus on OpenESB and NetBeans IDE for designing and building composite applications.
This book introduces basic SOA concepts and shows how you can use NetBeans and OpenESB tools to design and deploy a composite application. After introducing the SOA concepts, you are introduced to various NetBeans Editors and aids that you need to understand and work with to design a composite application. The last part of the book deals with a full fledged incremental example on how you can build a complex composite application with necessary screen shots accompanied by the source code available on the website.
Chapter 1 introduces SOA and BPEL to the readers with simple examples and gives an overview of the JBI components and runtime required to build composite applications. This chapter also gives you an overview of the need for SOA-based applications in companies by depicting an example of an imaginary AirlinesAlliance system.
Chapter 2 shows you how you can quickly setup NetBeans IDE and other runtime environments including OpenESB runtime and BPEL engine. There are many software/tools mentioned in this chapter that you need to download and configure to get started building composite applications using NetBeans.
Chapter 3 provides an overview of Java Business Integration (JBI) and the Enterprise Service Bus (ESB). You will learn about JBI Service Engines and how they are supported within the NetBeans IDE.
Chapter 4 introduces JBI Binding Components and how they provide protocol independent communication between JBI components. You will also learn about the support that the NetBeans IDE provides for Binding Components.
Chapter 5 introduces the NetBeans BPEL Designer that comes bundled with the NetBeans IDE. You will also be introduced to the graphical tools/wizards and palettes available for creating BPEL files.
Chapter 6 provides an overview of WSDL and how WSDL documents are formed. You will learn about the use of WSDL in enterprise applications and the WSDL editor within the NetBeans IDE
Chapter 7 covers the XML schema designer and shows how it aids rapid development and testing of XML schema documents.
Chapter 8 provides you an overview of the Intelligent Event Processor (IEP) module and the IEP Service Engine that can be acquired from the OpenESB software bundle. This chapter also shows the need for an event processing tool through simple composite application examples.
Chapter 9 provides details of fault handling within a BPEL process and shows how these can be managed within the NetBeans IDE by using graphical tools.
Chapter 10 shows you how you can build simple to complex composite applications and BPEL processes using the NetBeans IDE. The examples in this chapter are divided into several parts and the source code for all parts is available in the code bundle.
Chapter 11 gives you the overall picture of the composite application and the need for a composite application to deploy your BPEL processes. The composite application support provided in NetBeans IDE comes with a visual editor for adding and configuring WSDL ports and JBI modules.
This book is for enterprise developers and architects interested in using NetBeans IDE and OpenESB tools to build their SOA-based applications.
In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.
There are three styles for code. Code words in text are shown as follows: "message sayHelloRequest has been defined"
A block of code will be set as follows:
When we wish to draw your attention to a particular part of a code block, the relevant lines or items will be made bold:
New terms and important words are introduced in a bold-type font. Words that you see on the screen, in menus or dialog boxes for example, appear in our text like this: "From the New Project wizard, select SOA | BPEL Module".
Important notes appear in a box like this.
Tips and tricks appear like this.
Feedback from our readers is always welcome. Let us know what you think about this book, what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.
To send us general feedback, simply drop an email to <[email protected]>, making sure to mention the book title in the subject of your message.
If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or email <[email protected]>.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
Visit http://www.packtpub.com/files/code/2622_Code.zip, and select this book from the list of titles to download any example code or extra resources for this book. The files available for download will then be displayed.
The downloadable files contain instructions on how to use them.
Although we have taken every care to ensure the accuracy of our contents, mistakes do happen. If you find a mistake in one of our books — maybe a mistake in text or code — we would be grateful if you would report this to us. By doing this you can save other readers from frustration, and help to improve subsequent versions of this book. If you find any errata, report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the Submit Errata link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata added to the list of existing errata. The existing errata can be viewed by selecting your title from http://www.packtpub.com/support.
You can contact us at <[email protected]> if you are having a problem with some aspect of the book, and we will do our best to address it.
Organizations are rapidly moving towards an information-driven business model that exerts a lot of pressure on the response time. Response time is the primary issue for organizations adopting new technologies. Any Business process model designed by an organization should be flexible, extensible, and reliable primarily to tackle the "information burst" experienced by most enterprises.
The objective of this book is to help enterprise application architects and developers understand various Service Oriented Architecture (SOA) tools available as part of the NetBeans IDE thus, enabling them to build an enterprise grade, scalable application in a short period using a single development interface.
In this chapter, we will be discussing the following topics:
According to Gartner Inc., enterprises will eventually adopt SOA for their business critical processes, sooner or later. Although architects have been discussing and implementing SOA for the past several years, practicing SOA is still new, and generally requires the utmost care in application design when compared to other similar architectures. SOA always emphasizes on distributed architecture spanning multiple web services and applications that are part of a different heterogeneous category of applications. This in turn adds additional complexity to the whole system. If you do not carefully connect your various business applications through a set of well defined processes, it will lead to data chaos and breakdowns.
Not all SOA implementations you see today are tuned for maximum performance. In fact performance was always a key issue when considering SOA for business integration. When SOA principles are applied too rigidly, you can expect some run-time issues. Hence it is better not to go by any book or guidelines and instead, to adopt your own SOA-based system that is scalable and reliable for your needs. The primary factor that you need to understand is that SOA is a paradigm shift in doing business and requires a complete comprehension of the events, processes, and fault endpoints that occur in your enterprise.
Developing enterprise applications is much more than just building a system that can process and share data between web services and various clients. Consider, for example, an airlines reservation web service that processes the guest itinerary. If a reservation cannot be made, it should have the capability of contacting a partner airline's web service and then process the itinerary. If the itinerary processing is successful, it should confirm the booking to the client. Now, there is more than one type of enterprise system involved. Which part of your enterprise system will orchestrate the transaction? Who will set the guidelines for fail-safe communication? There is a clear need for a "middle man" or a "centralized web service" to orchestrate these disparate web services to make the reservation process successful and fail-safe. BPEL (Business Process Execution Language) is widely accepted as an industry standard for orchestrating web services to perform meaningful business processes.
This book focuses on using a particular BPEL implementation for solving business integration problems. This implementation is the BPEL Service Engine from the OpenESB project at https://open-esb.dev.java.net/.
Project OpenESB implements an Enterprise Service Bus runtime using Java Business Integration (JBI) as the base. This allows easy integration of web services to create loosely coupled enterprise class composite applications.
Today, most companies are considering SOA and web services as a viable business process model to address the integration needs for building a robust enterprise application. While SOA has become a model to implement and solve integration problems, many companies are still confused about implementing SOA as there appear to be a myriad of ways to implement an SOA-based model. Also there are companies that already have a time tested solution implemented and would like to move to the much extensible SOA model. SOA and POA based applications enable businesses by leveraging existing web services and by minimizing the cost of deploying new services.
The primary objective of designing an enterprise application is to glue together different services to suit a particular business need. However, there is a bigger challenge involved in designing this whole system wherein introducing new services or modifying existing services should not affect the system to a larger extent. This can only be achieved when you have a set of business processes that can orchestrate the system, making the services communicate with each other at the right time. Hence, orchestrating services through BPEL has become a much acclaimed solution for designing enterprise applications. BPEL is emerging as the clear standard for composing multiple synchronous and asynchronous services into collaborative and transactional process flows.
Well designed SOA-based applications reduce the cost and complexity of implementing business processes that cater to all the connected partners including customers, suppliers, and other clients. Prior to the SOA-based model, many businesses found this objective almost unattainable, because technical roadblocks made it difficult to offer a business process as a service that could be universally shared by its target community of users. The Web has demonstrated that universal access is not only possible but is now a fact of business life, and has proven that a combination of open protocols, tools, and infrastructure can create great value for the business community. The SOA extends this value to cover the creation and sharing of business processes, utilizing web protocols, tools, and infrastructure to meet this new objective. The challenge is to find the Service Orchestration Point for hosting the business processes that interact with heterogeneous services and provide a seamless and quick solution to the customers.
A business process is the procedure that an organization uses to achieve a larger business goal. A business process is actually a series of individual tasks, and each task is executed in a specific order. Business Processes are synchronous or asynchronous, depending on the method you choose to invoke your business process. A synchronous business process can contain asynchronous operations, but they must be added after the starting event in the process flow. That is, at runtime the processes are executed after the synchronous starting event is complete.
As an integral part of the NetBeans SOA tools, business processes provide the primary means through which enterprise services are integrated. NetBeans SOA tools features the BPEL Designer, which has been formulated so that architects can easily create complex composite applications involving web services without much programming effort. To this end, you can easily create and develop a business process in an intuitive graphical programming environment called the BPEL Designer and deploy it to a separate runtime environment for execution. This runtime is the OpenESB runtime that is integrated with the GlassFish application server.
The BPEL Process starts with a receive activity, proceeds with invoking external services and finishes by replying back to the Client. A BPEL process typically interacts with one or more external Web Services (the BPEL process is also a web service). These external web services are called partner services.
The above figure shows a preview of how a simple BPEL process can be designed using the NetBeans BPEL Designer. In the above example, there are two partner services, one is the BPEL client implementation and the other one is the web service EJB implementation which has one operation processItinerary.
In order to understand the simple BPEL process, let us define some of the terms most commonly used while designing a BPEL process.
Any external service or client that interacts with the BPEL process is called a partner service. A process starts and ends somewhere, and involves the interaction of at least one other outside partner. In the above example, the partner is the web service that has the ability to process the client's request. The customer sends the guest itinerary for processing. The BPEL process receives the itinerary, invokes a web service that processes the itinerary, and returns the itinerary back to the customer. This simple process helps us understand the BPEL activities that we will focus on later in this book.
Refer to Chapter 10 to learn how partner services can be designed and created using NetBeans.
Activities are the individual business tasks within the process that compose the larger business goal. In the previous screenshot, activities represent each step in the process. Thus the most common activities are Receive, Invoke, Assign, and Reply. For more information on the BPEL activities supported in the BPEL Designer, refer to Chapter 5.
In the previous example, between the Receive and the Invoke activity, we are assigning the guest itinerary elements to a new variable. (Assigning Guest name, travel date, preferred class.) This is basically a copying process (creates an XPath expression in the BPEL file) and it can be done visually using the NetBeans BPEL Mapper (explained in Chapter 5). Variables store the data that are used by the business process.
As we discussed earlier, the partner service interacts with the business process for the purpose of receiving a message in response to a request.
The above figure depicts a typical asynchronous and synchronous business process. An asynchronous process is used when the BPEL process is long-running. The results are returned to the client by performing an invocation on the client. Thus the customer asks for reservation and disconnects. The business process processes the requests and gets back to the customer. It is more like a "Leave a message and we will get back to you" kind of setup. This pause does not happen with a synchronous business process, wherein the customer waits indefinitely to get the response. A classic example is the reservation process.
However, there is a caveat here. The BPEL process is shared and is not a singleton. Many customers work with the same business process. There should be a way for the business process to identify its customers.
The above figure depicts an example wherein the customer sends a reservation request for a particular airlines' destination on a particular date. The business process, after communicating with the airlines' web service, finds out the reservation cannot be processed. Hence it updates the customer itinerary with an itinerary number that the customer can use later to send the reservation request.
This is how a correlation is used by the business process, to distinguish the customer in their initial interaction so that they can recognize each other in the future. A correlation is the record that the business process uses to keep track of multiple partners in the same business process. NetBeans BPEL Designer lets you set correlations for Invoke activities through a visual interface as discussed later in this book. Note that the business process is able to manage multiple tasks, and does not hang in a single business process waiting for it to conclude at the expense of all other activities. Instead, while they are waiting for the itinerary number to arrive, the process conducts similar business, using the same business process with other customers.
Since multiple clients can use the same business process, it is possible that each application implementation may desire slight variations of the same business process. Therefore, it is important that business processes have points-of-variability. Thus giving the user of the composite application the ability to configure the business process to their specific requirements.
A Business process can also be abstract in the sense that the appropriate business logic to make decisions is defined, but the sensitive information needed to choose a course of action is hidden from the process partners. An abstract process is basically a description of a business process, and cannot be run on the server, unlike an executable business process. We will discuss these processes in the coming chapters.
Consider the following guidelines for creating BPEL processes:
Why do you need to consider BPEL for orchestration? In a complex business transaction, just developing web services and exposing their functionalities over WSDL is not enough. Sequence of execution and branching in case of failures and other events are critical to business transactions. Sequencing and conditional behavior are the strengths of BPEL.
BPEL does the following for your business transactions:
A composite application is an accepted solution that addresses a specific business problem by bringing together business logic and data sources from multiple underlying systems. Typically a composite application will be associated with one or many business processes, and may bring together several process steps, presenting them to the client through a single interface that is customized to the requirements of the business need.
SOA describes a category of composite applications composed of service provider and service consumer components that segregates business logic and offers location transparency for the service providers and consumers. The SOA approach lets you replace or upgrade individual components in the application without affecting other components or the process as a whole. Moreover, you can independently specify alternative paths through which the components in the application exchange messages. The next couple of chapters in this book provide concepts and constructs needed for building a composite application using the NetBeans SOA tools.
Our example application that we will be creating in this book is finally deployed as a Java Business Integration (JBI) module in the JBI Runtime Environment provided by GlassFish application server.
JBI runtime is integrated with Sun Java System Application Server and the open-source GlassFish application server. This is the same JBI runtime that was available as part of OpenESB project. OpenESB is also available as an add-on in the Java Application Platform SDK.