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

Wrapping exceptions into faults


This recipe explains the definition of faults in web services. Faults are one of the fundamental concepts of handling errors in web services. Usually, web services throw an exception as a result of an unsuccessful operation. This recipe will explain how to define faults for an operation in case of a date format mismatch.

Getting ready

In this recipe, we will amend the implementation of our web service example from the Annotating the service endpoint interface with @SOAPBinding recipe.

How to do it…

We will change the source code of our example so that it will throw an exception in case there is a problem with processing a credit card operation. Now, if we run the example, even if the authorization fails, the processing is performed further. A more correct approach would be to handle faults and stop processing if a fault occurs.

We open the CreditCardGateway.java file in JDeveloper and search for the AuthoriseCreditCard method. We change the code so that it throws...