Preface

WS-BPEL 2.0 (Business Process Execution Language for Web Services, also BPEL or BPEL4WS) has become the industry standard for orchestration of services, implementation of business processes, and development of composite applications. BPEL provides a rich vocabulary for expressing the behavior of business processes and composites. Although it looks quite simple at first sight, BPEL provides a rich set of operations (called activities) to model the process flows of composite applications, such as asynchronous and parallel invocation of services, correlation, event, fault, compensation and termination handlers, scopes, source and destination links, and so on.

BPEL is an OASIS specification. It is not owned by a specific vendor or company. This means that using BPEL leads to the development of portable, vendor-agnostic solutions. BPEL is also supported by major BPM/SOA-development platforms, including most important commercial platforms such as Oracle SOA Suite and Oracle JDeveloper, IBM WebSphereBPM, and so on, and open source tools and servers, such as JBoss, Eclipse, and so on.

Although BPEL is widely used, studies have shown that most software architects and developers do not have an in-depth familiarity with the BPEL language. The majority of them are familiar only with the basics, which is also reflected in BPEL code that in most cases includes only the most straightforward activities. An in-depth familiarity with BPEL is essential to unleash its full potential. Therefore, it makes sense to publish a book that covers BPEL functionality for beginners, showing step-by-step how to use BPEL from the most straightforward to the more complex scenarios.

This book will guide software architects and developers through the BPEL language and teach them the various activities, use-cases, and scenarios that can be developed in BPEL. The book will be a beginner's guide, starting with the basics and advancing through different increasingly complex scenarios. The book will be tool-independent, but will show how to use BPEL with most popular tools, such as JDeveloper, SOA Suite (from Oracle), and so on.

What this book covers

Chapter 1, Hello BPEL, provides a basic understanding of BPEL. We will see that BPEL is an important part of Service Oriented Architecture (SOA). It is a language for service orchestration and uses the XML syntax. Usually, it is represented graphically for easier development. We will learn how to install Oracle JDeveloper and SOA Suite, how to create a domain on the SOA Suite server, and how to use JDeveloper to develop BPEL. We will develop two simple BPEL processes. The first one will be a very simple process returning the stock quantity of a book as a hardcoded constant. The second BPEL process will be a little more sophisticated and return the quantity depending on the ISSN number. In addition to understanding the BPEL source code, we will get an understanding of the <assign> and <if> activities as well. We will also learn how to deploy a BPEL process to the SOA Suite server and how to use the Enterprise Manage console to test the BPEL processes.

Chapter 2, Service Invocation, explains how to invoke and orchestrate services. We will explain the primary mission of BPEL—service orchestration. It follows the concept of programming-in-the-large. We will develop a BPEL process, which will invoke two services and orchestrate them. We will become familiar with the <invoke> activity and understand the service invocations background, particularly partner links and partner link types. We will also learn from BPEL that it is very easy to invoke services in parallel. To achieve this, we will use the <flow> activity. Within <flow>, we can nest several <invoke> activities, but also other BPEL activities.

Chapter 3, Variables, Data Manipulation, and Expressions, explains how to use variables in BPEL and how to manipulate data. We will explain that in BPEL all variables store XML. They are used to hold the requests and responses for invoked services (partner links), and also to store other data related to the process state. We will see that we can declare variables of three different types, message types, elements, and simple types. To manipulate data, we will use the <assign> activity. We will become familiar with the <assign> activity and learn how to use different possibilities when copying data. Probably, the most commonly used are expressions, which are written in XPath. We will also learn how to access variables from the expressions, how to validate variables, and how to use XSLT transformations to transform the data.

Chapter 4, Conditions and Loops, covers the conditions in BPEL processes. We will discuss the syntax of the <if>, <elseif>, and <else> activities and see an example on how to implement conditions. We will also take a close look at the loops. We will learn about the three types of loops that BPEL provides: <while>, <repeatUntil>, and <forEach>. The <forEach> loop also provides the ability to execute the loop instances in parallel. We will implement the <while> and <forEach> loops, the latter in a sequential and parallel way. We will also get familiar with delays, which can be useful in loops. With delays, we can specify a certain deadline or duration. We will learn how to specify both. Finally, we will see how to end a BPEL process with the <exit> activity and why and when to use <empty> activities.

Chapter 5, Interaction Patterns in BPEL, covers how to communicate with external web services in an asynchronous manner and also we will learn how invoke an asynchronous BPEL process. This chapter is important as asynchronous communication is essential in real-world, long-running business processes where the request response time is undeterministic for a particular external web service invocation. Also, there are circumstances where the endpoints defined for the response and for the particular request are exposed by different web services. As an example, a business process can invoke its purchase service. However, the confirmation response to that particular request actually comes from the shipping process. So, in such scenarios, asynchronous communication is inevitable. The concepts we learn in this chapter are useful in real-world business process developments.

Chapter 6, Fault Handling and Signaling, first explains some of the faults that could be generated within a business process. Then we discuss what a fault handler is. We move on to a sample that covers these aspects and we explain how the BPEL 2.0 specification models the aforementioned faults. We categorize these faults into three groups as follows:

  • Modeling execution errors with BPEL 2.0 Standard Faults
  • Modeling logical (explicit) errors with the <throw> activity
  • Modeling errors propagated from external web services

We describe how logical (explicit) faults are signaled within the business process definition, and then we will explain how a signaled fault is propagated back to the client of the business process. So at the end of this chapter, the reader will be capable of declaring fault handling behaviors to a business process.

Chapter 7, Working with Scopes, introduces the concept of the <scope> activity and describes the advantages of it. We will see how to add <scope> activities to hierarchically organize the Book Warehousing sample. Some between the differences of the <scope> activity and other activities such as <process>, <sequence>, and <flow> are explained. Then we will see how to add a fault handler and a termination handler to a <scope> activity. Finally, we will introduce the concept of isolated scopes.

So at the end of this chapter, the reader will be capable of declaring the <scope> activity to organize a BPEL 2.0 process hierarchically.

Chapter 8, Dynamic Parallel Invocations, explains the <forEach> activity in detail. It lets us define repetitive tasks in a sequential or in a parallel manner. First, we will learn a practical use-case of the <forEach> activity by trying out an example. Then, we will see how to configure a <forEach> activity step by step. During this exercise, we will also learn about dynamic partner links as a requirement to invoke different end points within the <forEach> activity in parallel. After that exercise, we will explain each configuration within the <forEach> activity that determines the repetitive and parallel behavior. So, at the end of this chapter, the reader will be capable of declaring the <forEach> activity to define repetitive tasks in sequence or in parallel.

Chapter 9, Human Tasks, introduces the concept of human interactions in BPEL 2.0 processes. We will first learn how human interactions work. Then, we will go on to develop human task definitions and configure them with assignments, deadlines, notifications, and other important properties. We will continue with invoking a human task from the BPEL process and receiving the human task outcomes. You can make use of the concepts we learn in this chapter in real-world scenarios to model business processes with human user interactions.

Chapter 10, Events and Event Handlers, discusses how event handlers provide a mechanism for running business processes to react to events that can be triggered, without interfering with the main flow of the process. In this chapter, we will take a brief look at Event Driven Architecture (EDA). We will explain how a BPEL process can react on events. We will get familiar with business, message, and alarm events, and understand the difference between deadlines and durations. We will learn how to develop event-driven BPEL processes and how to invoke events from BPEL processes. We will also learn how to use the <pick> activity and <eventHandlers> at either the scope or process level. Furthermore, we will explain <onEvent> for triggering events by incoming messages that correspond to operations in WSDLs and <onAlarm>, which needs to be triggered when a deadline is reached or after a specified period. By following this chapter to add the event handlers and event-related activities for the BPEL sample, the reader gains the capability to model BPEL 2.0 processes to accept requests that arrive in parallel to its normal flow of control.

Chapter 11, Compensations, discusses the backward recovery or rollback mechanism for BPEL 2.0 processes. Here, for achieving compensation, we will learn how to use <compensationHandler>, then <compensate>, and <compensateScope> activities. Later, we will extend our sample to include a compensation that reverses the effects of activities which were completed up until a fault occurred in the process. After reading this chapter, you will have a clear understanding of how to undo previous operations, using compensation to get back to a consistent state.

Appendix B, BPEL Syntax Reference, provides a lot of useful syntax references for the WS-BPEL Web Services Business Process Execution Language. The complete appendix can be found online at https://www.packtpub.com/sites/default/files/downloads/8963EN_Appendix_B.pdf.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset