Customers often think that BPEL is only about creating and managing process flows. In a sense that is true but the processes created can sometimes be very simple yet add a useful new service to your array of services. Service Oriented Architecture is about creating services and then re-using those services to create business solutions or other services. Lets look at the latter.
Lets take the example of a stock price service. Generally stock price services will return the stock price in a single currency - US Dollars if the stock is on the New York Stock Exchange, Pounds Sterling if the stock is on the London markets etc. However we may want the stock in our local currency. For example when I look at the Oracle stock price, I really want to know what it is in pounds sterling as that is the currency I buy my groceries in.
So what I really want (OK what I really want is a Porsche but I can always dream) is a stock price service that automatically quotes the stock price in my own currency of choice. With BPEL I can very rapidly create such a service and in this blog we will explore how.
The first step in creating my composite service was to create an outline of the business process. The outline consists of creating a simple BPEL process that did what I wanted but didn't have all the details added.
The process consisted of the following steps
The next step was to fill in the details for the Stock Price Service.
A quick search of the XMethods site revealed a good example of a Stock Price service. The service description can be found at http://ws.cdyne.com/delayedstockquote/delayedstockquote.asmx?wsdl. This service doesn't define partner roles, but the BPEL Designer generated a wrapper WSDL that added partner roles to the service WSDL.his WSDL
I was now able to fill in the details of the call to the stock price service, filling in the method to be invoked and having the designer create appropriate variables for the input and output parameters.
I then needed to repeat the process for the Exchange Rate Service.
Again XMethods revealed a suitable service. In this case the service description can be found here http://www.xmethods.net/sd/2001/CurrencyExchangeService.wsdl. Again the BPEL Designer generated a wrapper around the WSDL that defined partner roles.
Again it was now just a case of adding extra details.
Finally we need to multiply the exchange rate by the stock price to give us the stock price in our favored currency. An XPath expression is used for this. The process is then ready for deployment to the BPEL Process Manager. Voila, a new service is born.
It has taken longer to write this Blog than it took to create the service. I used an internal build of JDeveloper to build the composite service but I could have used the publicly available Eclipse plug-in.
As the Stock Price Service and the Exchange Rate Service were both synchronous services it made sense for my BPEL process to be a synchronous service as well. However I could just as easily have made it an asynchronous service.
The new Local Stock Price Service is not a business process in its own right, instead it is a useful new composite service. You don't have to be a Java or C# wizard to create these composite services, making SOA accessible to a much larger pool of developers. Now any developer can rapidly create composite services from existing web services.
So what composite services would be useful in your business?
My colleague Newton Johnstone provided the inspiration for this Blog when he set the creation of a composite Local Currency Stock Quote Service as an exercise in a BPEL course he was teaching. Thanks Newton. The original concept came from another colleague, Manh-Kiet Yap who presented it at Oracle World. Kiet also showed me how to use the callout functions to oracle Wireless to allow BPEL to send SMS messages, we will look at this functionality in a future blog.