« Creating a New XML Schema | Main | Java Conundrum »

Building a new WSDL Interface to a BPEL Process

Building a BPEL Process Interface


In my last entry we looked at how to define the data structures associated with a BPEL process. In this entry I will explain how I would create the input and output interfaces of a BPEL process.


Creating the Request Interface


A BPEL process is always kicked off by some sort of Web Service request. This means that we need to define a suitable request. To do this I created a BPEL project and accepted the default asynch structure.


Importing the Schema


Next step is to bring in the schema we created last time. To do this I selected the bpel file in the "Applications - Navigator" window. In the structure window underneath I then right clicked on the "Project Schemas" and selected import schema. I then imported the schema we created earlier.






Click to view full size


Defining the Input Message


Now that we have imported the data types we defined we can use them in a message. I opened the BPEL process file in the editor and then in the structure window I navigated to the input message. Double clicking the input message I verified that it was the message I wanted, the input or request message.






Click to view full size


I then edited the message, setting the payload type to be an element, and then used the schema or type navigator to set the payload to be an element of the right type.






Click to view full size


Defining the Input Variable


Having changed the message type I needed to fix up the input message variable to be of an appropriate type. I again did this by using the structure navigator to select and edit the input variable, setting it to be the correct message type.






Click to view full size


Creating an Intermediate Response


Defining the Request Return Value Message


Often when creating a process I want to hand off some sort of tracking ID to the requestor. Lets enhance the initiate method to add this return value.


To start with lets create a new message to contain the data. I did this by selecting the process WSDL under messages in the structure window and right clicking to select create message. I then gave the message a name and added a new part to the message with a simple type of String.






Click to view full size


Adding the message to the method


If you changed the name of the input message, as I did, you will get a BPEL compilation error "Variable type does not match input type". To fix this select the wsdl file and in the navigator window go to the port type for the input message and edit the input message setting it to the correct type.






Click to view full size


Once this problem was sorted I created an output component to the request port type - note make sure you add the output to the right port type.  There is no indication which one you are editing unless you look at the properties.  Then set the message type to be of the type you just created.






Click to view full size


Adding the Reply to the Process


I now have a WSDL document that allows me to return an intermediate result.  However my BPEL process doesn't return this yet so I need to add a reply element to pass this back to the original invoker.  Before doing this I go in to the client partner link and refresh the WSDL so that I have the right definitions.  I then dragged a reply icon onto the diagram and wired it up to the client as a return value.  Automatically creating a variable of the right type along the way.






Click to view full size


Putting it Together


I'm a great believer in trying things out as you go, so I now deployed my process to the Oracle BPEL server and tried it out, noticing that the server did a great job of building an input form for me.  I did execute the process, but at this point it was not very exciting.....






Click to view full size


Useful Pattern


The pattern used here of returning a partial result is one that we commonly employed when I worked in the travel reservation industry.  We would try and get all the data we needed synchronously, but if the result wan't available we would return what we had available and then return the rest later.  The type of interface we have created here allows just this sort of interaction.  Another use for it is to return the client initiator a reference field that he can use to make additional queries against the process.  Using custom correlation sets we can have the Oracle BPEL process associate future calls using the returned identifier be associated with the original process.


Whinging


As I built this with the beta release of Oracle BPEL Process Manager 10.1.2 I was really impressed by how much I could do through the GUI.  But one area frustrated me.  I wanted a full bloodied WSDL editor.  Part of it I got around by navigating and editing messages through the BPEL structure editor.  But I really wanted a WSDL structure editor that would let me choose types for my method parameters in the same way I chose types for my messages using the type explorer.


The production release of 10.1.2 is now imminent and I look forward eagerly to playing with that, although as one customer said to me last week, the beta is so stable it feels like production software already.

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

About This Entry

This page contains a single entry from the blog posted on May 18, 2005 6:52 PM.

The previous post in this blog was Creating a New XML Schema.

The next post in this blog is Java Conundrum.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type and Oracle