Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
BPEL and Java Cookbook
BPEL and Java Cookbook

BPEL and Java Cookbook: Written by an SOA guru to help you orchestrate web services, the 100 recipes in this book will make integrating Java and BPEL a smooth process. Using the examples you'll avoid common problems and learn sophisticated techniques.

Arrow left icon
Profile Icon Laznik
Arrow right icon
R$50 per month
Paperback Sep 2013 382 pages 1st Edition
eBook
R$80 R$294.99
Paperback
R$367.99
Subscription
Free Trial
Renews at R$50p/m
Arrow left icon
Profile Icon Laznik
Arrow right icon
R$50 per month
Paperback Sep 2013 382 pages 1st Edition
eBook
R$80 R$294.99
Paperback
R$367.99
Subscription
Free Trial
Renews at R$50p/m
eBook
R$80 R$294.99
Paperback
R$367.99
Subscription
Free Trial
Renews at R$50p/m

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
Table of content icon View table of contents Preview book icon Preview Book

BPEL and Java Cookbook

Chapter 2. Calling Services from BPEL

This chapter contains the following recipes:

  • Implementing web services with Axis2
  • Implementing web services with JAX-WS
  • Invoking RESTful web services
  • Invoking synchronous web services
  • Invoking asynchronous web services
  • Dynamic selection of a web service endpoint
  • Invoking web services in a sequence
  • Invoking web services in parallel
  • Handling the faults thrown from web services
  • Throwing the faults from BPEL

Introduction

Web services have evolved into a matured technology over the past few years. A web service, as the W3C consortium defines it, is a software system designed to support interoperable machine-to-machine interaction over a network. Large enterprises are seeking ways to make IT more agile to support their business processes. On the one hand, they are trying to make the best out of the existing applications, and on the other hand, they are attempting to minimize the costs of developing new solutions.

The Service-Oriented Architecture (SOA) presents an architecture that enables agile IT technology for the business process management. With the appearance of web services, the foundation of modular applications was set in SOA. Since web services are technology-neutral, they enable high interoperability. While exposing small-scale application pieces or business services, web services enable integration and reusability. Both facts result in saving time and money.

Web services can be seen...

Implementing web services with Axis2

This recipe describes how to implement web services in Apache Axis2. We will show you how to implement the Axis2 annotated web service, and deploy it to the Axis2 server. We will explore the typical lifecycle of a web service.

Getting ready

We use the Eclipse IDE (Eclipse IDE for Java EE Developers Version) for the development of web services. We also need the Apache AXIS2 package for the web service deployment.

Note

Oracle also provides the Oracle Enterprise Pack for Eclipse for those who prefer the Eclipse IDE over the JDeveloper IDE. The package can be found at http://www.oracle.com/technetwork/developer-tools/eclipse/overview/index.html?ssSourceSiteId=ocomen.

How to do it…

The following steps present the creation, packaging, and deployment on the Axis2 server, and the testing procedures in the lifecycle of a web service:

  1. We will start by creating the project in Eclipse. In the New Java Project wizard, we just enter the project name, and then click...

Introduction


Web services have evolved into a matured technology over the past few years. A web service, as the W3C consortium defines it, is a software system designed to support interoperable machine-to-machine interaction over a network. Large enterprises are seeking ways to make IT more agile to support their business processes. On the one hand, they are trying to make the best out of the existing applications, and on the other hand, they are attempting to minimize the costs of developing new solutions.

The Service-Oriented Architecture (SOA) presents an architecture that enables agile IT technology for the business process management. With the appearance of web services, the foundation of modular applications was set in SOA. Since web services are technology-neutral, they enable high interoperability. While exposing small-scale application pieces or business services, web services enable integration and reusability. Both facts result in saving time and money.

Web services can be seen...

Implementing web services with Axis2


This recipe describes how to implement web services in Apache Axis2. We will show you how to implement the Axis2 annotated web service, and deploy it to the Axis2 server. We will explore the typical lifecycle of a web service.

Getting ready

We use the Eclipse IDE (Eclipse IDE for Java EE Developers Version) for the development of web services. We also need the Apache AXIS2 package for the web service deployment.

Note

Oracle also provides the Oracle Enterprise Pack for Eclipse for those who prefer the Eclipse IDE over the JDeveloper IDE. The package can be found at http://www.oracle.com/technetwork/developer-tools/eclipse/overview/index.html?ssSourceSiteId=ocomen.

How to do it…

The following steps present the creation, packaging, and deployment on the Axis2 server, and the testing procedures in the lifecycle of a web service:

  1. We will start by creating the project in Eclipse. In the New Java Project wizard, we just enter the project name, and then click on Finish...

Implementing web services with JAX-WS


This recipe will explore the implementation of web services with JAX-WS. For web service construction, we will use the top-down approach.

Getting ready

In the recipe Implementing web services with Axis2, we started web service implementation with the POJO class. The approach is called the bottom-up design. We will start the development of web services in JAX-WS from the WSDL definition; that is, we will use the top-down approach.

Initially, we create a new Java project in Eclipse. In the wizard, we change the output directory from bin to classes. When the project is created, we amend it with the following actions:

  1. Create the wsdl directory. We put it in the WSDL file that is our starting point of creating a web service.

  2. Create the build directory. The directory presents the placeholder, where the deployment package will be created.

  3. Create an empty build.xml file at the top-level project directory.

The WSDL file for our example web service is as follows:

&lt...

Invoking the RESTful web services


The REST web services are becoming more and more popular, because of their simplicity over the SOAP and WSDL-based web services. This recipe will explore how to call the RESTful web services from the BPEL process.

Getting ready

We have prepared a RESTful web service that returns the weather conditions based on the city criteria. The web service is developed in JDeveloper and deployed to the Oracle SOA Suite server. We developed the RESTful web services with Jersey, which supports the JAX-RS (the Java API for the RESTful web services) specification covered by Java Specification Request 311.

We created the sample RESTful weather service with the following code:

@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" +...

Invoking the synchronous web service


The BPEL process acts as an orchestration component of SOA. One of its fundamental abilities is to invoke web services. This recipe describes how to invoke the synchronous web service.

Getting ready

Before we start with the recipe, we need access to the synchronous web service. We will use the weather service from the Invoking the RESTful web services recipe.

How to do it…

The following steps describe the actions necessary in order to design the BPEL process for invoking the synchronous web service:

  1. We start the recipe by modeling the SOA composite. We add the web service to the SOA composite, and it should look like the following screenshot:

  2. In the BPEL process, we first assign the parameters for the web service. Next, we invoke the web service with the <invoke> activity as follows:

    <invoke name = "CallWeather" partnerLink = "WeatherSvcs" portType = "ns2:WeatherPT" operation = "QueryWeather" inputVariable = "CallWeather_QueryWeather_InputVariable"...

Invoking the asynchronous web service


The asynchronous web service is opposite to the synchronous request-response mechanism, as the asynchronous web services use a one-way mechanism. This type of invocation is recommended for long-running web services. The asynchronous web service invocation is especially handy in scenarios where we cannot expect the response in a reasonable time constraint such as the integration of payment systems between banks where confirmations are sent according to the contracts and can take from a few seconds to a few days. In this recipe, we will explore how to invoke the asynchronous web service from the BPEL process.

Getting ready

Before we start with the recipe, we need access to the asynchronous web service. Since the BPEL processes also have the possibility to be exposed as the web services endpoints, we will use the asynchronous BPEL process for this recipe. That way we will also show how to call one BPEL process from another BPEL process.

How to do it…

The following...

The dynamic selection of the web service's endpoint


In this recipe, we will explore how to dynamically call web services from the BPEL process. Such an approach can be useful in an early stage of the SOA adoption or when we don't have the middleware infrastructure set up yet and we have, for example, a set of redundant web services. In such a scenario, we need to provide ourselves with the functionality for the BPEL process to dynamically select the web service's endpoint.

Getting ready

We start this recipe by deploying the same web service to multiple instances of the servers. We decided to use the hotel reservation service from the Implementing web services with Axis2 recipe. We deployed the web service to the three instances of the server. The interface of web service remains the same; however, the address on which the web services reside do change as follows:

Server 1: <soap:address location = "http://192.168.1.101:7777/axis2/services/BookHotelService/"/>
Server 2: <soap:address...

Invoking web services in a sequence


In this recipe, we will identify how to call web services in a sequence from the BPEL process. The sequential web service invocation presents one of the basic workflow concepts. We use this approach when we have several web services in our business process and each of them needs to wait for the previous one to finish.

Getting ready

We need to set up an environment where we can access multiple web services. Since the BPEL processes are also exposed as web services, we can also call another BPEL process in a sequence.

How to do it…

The following steps explain how to call a web service in a sequence from the BPEL process:

  1. We will start with the creation of an empty BPEL process. We can choose the synchronous or asynchronous BPEL process. We start by adding the web services references to the SOA composite. We add the following two web service references:

    • BookHotelSvc: This web reference helps to gather the hotel names that have available rooms in a selected period...

Invoking web services in parallel


In cases where the invocation of web services is not interdependent, we can invoke web services in parallel. The parallel invocation shortens the BPEL process execution time. In this recipe, we will show you how to invoke web services in parallel.

Getting ready

For this recipe we will consume two web services. We will check for the hotel room and car availability in parallel. The availability data will give us information on hotels, where the rooms are available, and a car that is available for the date range. In order to complete the recipe, we need to deploy BookHotelService and BookCarService. The procedure for deploying web services can be taken from the Implementing web services with Axis2 recipe.

How to do it…

The following steps will cover the necessary activities to design the BPEL process for the parallel web service invocation:

  1. We start by creating the SOA composite. We add two web service references and wire them to the BPEL process as shown in the...

Left arrow icon Right arrow icon

Key benefits

  • Easy to understand recipes for integrating Java and BPEL
  • Covers wide range of integration possibilities for orchestrating business processes
  • Provides step-by-step instructions on examples stretching throughout the chapters, covering all phases of development from specification to testing
  •  

Description

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.  

Who is this book for?

This book is aimed at Java developers who need to use BPEL programming to develop web services in SOA development. You should be experienced with Java programming and SOA, but knowledge of BPEL is not necessarily required.

What you will learn

  • Call synchronous and asynchronous BPEL processes from Java code
  • Implement of web services with AXIS2 and JAX-WS
  • Call synchronous and asynchronous web services from BPEL process
  • Efficiently utilise the tracing and logging for tracking business process execution
  • Make use of validation and transformation of the BPEL services
  • Employ various techniques to variable manipulations in BPEL
  • Use annotations for describing web services
  • Perform work, management and monitoring tasks with the Oracle Enterprise Manager Console
  • Utilize the internal and external BPEL engine logging and tracing capabilities
  • Integrate various technologies for orchestration
  • Learn the techniques of using XML fa?ßades
  • Design, monitor and test SOA composite applications

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Sep 17, 2013
Length: 382 pages
Edition : 1st
Language : English
ISBN-13 : 9781849689205
Vendor :
Oracle
Category :
Languages :

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

Publication date : Sep 17, 2013
Length: 382 pages
Edition : 1st
Language : English
ISBN-13 : 9781849689205
Vendor :
Oracle
Category :
Languages :

Packt Subscriptions

See our plans and pricing
Modal Close icon
R$50 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
R$500 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just R$25 each
Feature tick icon Exclusive print discounts
R$800 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just R$25 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total R$ 1,103.97
BPEL and Java Cookbook
R$367.99
Applied SOA Patterns on the Oracle Platform
R$367.99
Oracle SOA Governance 11g Implementation
R$367.99
Total R$ 1,103.97 Stars icon

Table of Contents

12 Chapters
1. Calling BPEL from Java Chevron down icon Chevron up icon
2. Calling Services from BPEL Chevron down icon Chevron up icon
3. Advanced Tracing and Logging Chevron down icon Chevron up icon
4. Custom Logging in the Oracle SOA Suite Chevron down icon Chevron up icon
5. Transforming and Validating the BPEL Services Chevron down icon Chevron up icon
6. Embedding Third-party Java Libraries Chevron down icon Chevron up icon
7. Accessing and Updating the Variables Chevron down icon Chevron up icon
8. Exposing Java Code as a SOAP Service Chevron down icon Chevron up icon
9. Embedding Java Code Snippets Chevron down icon Chevron up icon
10. Using XML Facade for DOM Chevron down icon Chevron up icon
11. Exposing Java Code as a Web Service Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.