Let's create the BookWarehousingBPEL
BPEL process:
BookWarehousingBPEL
, modify the namespace to http://packtpub.com/Bookstore/BookWarehousingBPEL
, and select Synchronous BPEL Process. We will leave all other fields to their default values:BookWarehousingBPEL
component with the BookstoreABPEL
and BookstoreBBPEL
components. This way, we will establish a partner link between them. First, we will create the wire to the BookstoreBBPEL
component (although the order doesn't matter). To do this, you have to click on the bottom-right side of the component. Once you place the mouse pointer above the component, circles on the edges will appear. You need to start with the circle labelled Drag to add a new Reference and connect it with the service interface circle, as shown in the following screenshot:BookWarehousingBPEL
component with the BookstoreABPEL
component:BookWarehousingBPEL
component is wired to the BookstoreABPEL
and BookstoreBBPEL
components:We have added the BookWarehousingBPEL
component to our SOA composite and wired it to the BookstoreABPEL
and BookstoreBBPEL
components. Creating the wires between components means that references have been created and relations between components have been established. In other words, we have expressed that the BookWarehousingBPEL
component will be able to invoke the BookstoreABPEL
and BookstoreBBPEL
components. This is exactly what we want to achieve with our BookWarehousingBPEL
process, which will orchestrate both bookstore BPELs.
Once we have created the components and wired them accordingly, we are ready to implement the BookWarehousingBPEL
process.
To implement the book warehousing BPEL process, we need to follow a few steps. As already mentioned, we have created a synchronous BPEL process.
Every synchronous BPEL process starts with a <receive>
activity and ends with a <reply>
activity. In Chapter 5, Interaction Patterns in BPEL, we will learn about asynchronous BPEL processes. These do not need to return a response. If they want to return it, they can use a callback using the <invoke>
activity.
First, we have to define the
XSD schema that will be used for the request and response messages. Let's suppose that the client will send the following data within the request message (the one received in the initial <receive>
activity):
The response of the book warehousing BPEL process will be relatively simple and will only include string
with the selected bookstore location.
Then, we will follow the process flow, which we defined earlier in this chapter. We will basically need to do the following:
<receive>
activity, we will prepare a request for both bookstore BPEL processes. We will use <assign>
for this.<invoke>
.<if>
and create a reply.To hold the request and response messages for BookstoreA
and BookstoreB
, we will need four variables: BookstoreARequest
, BookstoreAResponse
, BookstoreBRequest
, and BookstoreBResponse
. We will create these variables on the fly and discuss variables in more detail in Chapter 3, Variables, Data Manipulation, and Expressions.