Book Image

BPEL and Java Cookbook

By : Jurij Laznik
Book Image

BPEL and Java Cookbook

By: Jurij Laznik

Overview of this book

The Business Process Execution Language (BPEL) has become the de-facto standard for orchestrating web services. BPEL and web services are both clamped into Service-oriented Architecture (SOA). Development of efficient SOA composites too often requires usage of other technologies or languages, like Java. This Cookbook explains through the use of examples how to efficiently integrate BPEL with custom Java functionality.If you need to use BPEL programming to develop web services in SOA development, this book is for you.BPEL and Java Cookbook will show you how to efficiently integrate custom Java functionality into BPEL processes. Based on practical examples, this book shows you the solutions to a number of issues developers come across when designing SOA composite applications. The integration between the two technologies is shown two-fold; the book focuses on the ways that Java utilizes the BPEL and vice-versa.With this book, you will take a journey through a number of recipes that solve particular problems with developing SOA composite applications. Each chapter works on a different set of recipes in a specific area. The recipes cover the whole lifecycle of developing SOA composites: from specification, through design, testing and deployment. BPEL and Java Cookbook starts off with recipes that cover initiation of BPEL from Java and vice-versa. It then moves on to logging and tracing facilities, validation and transformation of BPEL servers, embedding of third-party Java libraries into BPEL. It also covers manipulation with variables in BPEL different techniques of Java code wrapping for web service usage and utilization of XML fa?ßades. After reading BPEL and Java Cookbook you will be able to circumvent many of the issues that developers experience during SOA composite application development.  
Table of Contents (18 chapters)
BPEL and Java Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Preface

This book consists of many recipes providing solutions for the problems that the BPEL and Java developers face performing everyday jobs. The book provides step-by-step examples which get more completed throughout each chapter. It provides a lot of information to the developers with different levels of experience. The book consists of examples focusing on the interaction between Java and BPEL, how to enhance SOA composite applications, and how to make your applications more interactive with custom Java functionality. BPEL has become the de-facto standard for orchestrating web services. BPEL and Java are clamped into Service-oriented Architecture (SOA). Development of efficient SOA composites too often requires usage of other technologies or languages such as Java.Readers who choose to read an entire chapter will first be given a detailed overview of the topic covered in the chapter and why it plays an important role in SOA. The recipes following the introduction concentrate on the specific problems related to the topic area and provide at least one solution to it. Many of the recipes also explore further possible solutions to the presented problems.

What this book covers

Chapter 1, Calling BPEL from Java, explains how to call a BPEL process from Java programs. Invoking synchronous and asynchronous BPEL processes from the Java code is also covered.

Chapter 2, Calling Services from BPEL, introduces the development lifecycle of web services and explains how to call web services from a BPEL process.

Chapter 3, Advanced Tracing and Logging, covers the configuration of logging in Oracle SOA Suite and explains the usage of the BPEL processes and composite sensors.

Chapter 4, Custom Logging in the Oracle SOA Suite, explains the advanced techniques of logging and provides an in-depth view of logging in Oracle SOA Suite.

Chapter 5, Transforming and Validating the BPEL Services, covers the transformation of the variables with XSLT in the BPEL processes and introduces the development of the user-defined functions.

Chapter 6, Embedding Third-party Java Libraries, explains the usage of the extensions in JDeveloper, the BPEL processes, and Oracle SOA Suite in general.

Chapter 7, Accessing and Updating the Variables, will help us discover all the aspects of the variable manipulation in the BPEL processes.

Chapter 8, Exposing Java Code as a SOAP Service, introduces the complete lifecycle of web service development with the bottom-up design approach in Oracle SOA Suite.

Chapter 9, Embedding Java Code Snippets, deals with using and executing the Java code from the BPEL processes and introduces the development sandbox for the Java code to be executed in the BPEL processes.

Chapter 10, Using XML Facade for DOM, focuses on all the aspects of XML façade development, which helps us overcome the problems with DOM manipulation in the BPEL processes from the Java code.

Chapter 11, Exposing Java Code as a Web Service, shows how to expose the Java code to become a web service. The whole web service lifecycle is covered in a neutral vendor solution manner using the JAX-WS annotations.

What you need for this book

To use this book efficiently, the required software to be installed is Oracle SOA Suite 11g v11.1.1.6.0. The majority of the recipes also use Oracle JDeveloper 11g v11.1.1.6.0. Some recipes use the Eclipse development environment. Those recipes were developed using Eclipse IDE Juno v4.2 – SR2. For the web services development, we also use Apache Axis2 v1.6.1. For the advanced logging recipes, we use Apache Log4j v1.2.17.

Who this book is for

This book is aimed at the Java developers who need to use BPEL programming to develop web services for SOA development. It is assumed that readers have some prior knowledge of SOA development. Developers should be experienced with Java programming, but knowledge of BPEL is not necessarily required. It does not matter if you are an experienced developer or just starting to learn. There are recipes suitable for every knowledge level. For beginners, we provide introductory explanations with references. More experienced developers will find the recipe description of how they work and discussion on how the topic can be further enhanced very useful.

Conventions

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.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "Let us examine the ClientProxy.java class first. We start, by creating the ServiceClient client and prepare the Options class to configure the ServiceClient client."

A block of code is set as follows:

<element name = "fault">
<complexType>
<sequence>
<element name = "msg" type = "string"/>
</sequence>
</complexType>
</element>

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

@Path("RESTWeatherService")
public class WeatherProvider {
  
  @GET
  @Path("/query")
  @Produces("text/xml")
  public String getWeatherInfo(@QueryParam("name") String name, @QueryParam("zip") String zip) {
    return "<weatherRes>Hello " + name + ". The weather in " + zip + " city cloudy. \n" + "Temperature is 24 degrees Celsius. \n" + "Humidity is 74%</weatherRes>";
    }
  }

Any command-line input or output is written as follows:

Error deploying BPEL suitcase.
error while attempting to deploy the BPEL component file "C:\Programs\Oracle\Middleware\user_projects\domains\SOA_Dev\servers\AdminServer\dc\soa_8606ace0-2193-4
719-8cd7-08b2f0d57a04"; the exception reported is: java.lang.RuntimeException: failed to compile execlets of BPELProcess2_0
This error contained an exception thrown by the underlying deployment module.
Verify the exception trace in the log (with logging level set to debug mode).

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "When you double-click on the Java Embedding activity, a new dialog opens where we have to enter the code. We finish configuring the Java Embedding activity by clicking on the OK button."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

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 send an e-mail to , and mention the book title via the subject of your message.

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.

Customer support

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.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.