WS-BPEL 2.0 Beginner's Guide
上QQ阅读APP看书,第一时间看更新

Time for action – creating XML Schema for the BPEL process

Before we can start developing our BPEL process, we have to specify the XSD elements used for the input and output messages (for the request and the response message). Also, the XSD elements are used for variables within the BPEL process.

The XML schema has already been created and can be found in the BookstoreABPEL.xsd file. The default XSD elements for request and response contain only strings, which are not adequate for our example. Therefore, we will modify it.

First, we will rename it from BookstoreABPEL.xsd to BookstoreBPEL.xsd. The reason is that we might use same XSD for more than one bookstore, so we would like to have a generic XSD filename.

Our request element consists of the following elements: book ISSN, book title, edition, and date of publishing. The response element consists of the following elements: book ISSN and stock quantity.

We will perform the following steps:

  1. To rename XSD, right-click on the BookstoreABPEL.xsd file in the project tree, select Refactor, and then Rename:
  2. In the dialog box, enter the new name, BookstoreBPEL.xsd.
  3. Double-click on the BookstoreBPEL.xsd file in the Schemas folder and switch to source view.
  4. We have to define two complex elements. First, edit the existing process element, rename it to the BookData element, and enter the code shown in the following screenshot:
  5. Next, define the content of the processResponse element, which we will rename to BookDataResponse and add the two elements shown in the following screenshot:

Before we continue, let's save the XSD file.

What just happened?

We created the XSD elements used by the BPEL process. To be more accurate, we modified the autogenerated XSD file and specified the request element (BookData) and the response element (BookDataReponse).

The request element (BookData) is used as the input for the initial receive activity (receiveInput). The response element (BookDataReponse) is used by the final reply activity (replyOutput).

This is specified in the autogenerated WSDL file, which you can find in the WSDLs folder. It is named BookstoreABPEL.wsdl. Let's have a look at it.