Exposing a new service via Oracle Service Bus

Note: This post was first published before Oracle merged with BEA when the Oracle Service Bus product was known as AquaLogic Service Bus, hence the occasional reference to BEA and AquaLogic Service Bus.

In my previous post I talked about how to add a service to Oracle Service Bus. In this post I am going to explain the typical next step: how to take this business service and expose it as a new service.

"But why can't my service consumers connect directly to my business service, without the need for Oracle Service Bus?" I hear you say. The answer is - they could, however the result is a tightly coupled, point-to-point solution where any change to either the service consumer or business service will almost certainly require a change in the other - not very practical if you have a number of service consumers or you are not in control of both the service consumer(s) and business service.

Oracle Service Bus addresses this problem through the notion of a Proxy Service - a new service created on the bus which describes how your business service(s) are exposed to your service consumer(s). As well as providing loose coupling between the service consumer(s) and business service(s), proxy services are a good place to implement any mediation of service requests (and/or responses), such as validation, enrichment, transformation (of both data and protocol) and routing. Encapsulating this mediation logic within the proxy service allows it to be changed more easily than if it was part of the service consumer or business service and helps maximises the reusability of both service consumer and business service.

Now we understand the purpose and benefits of having a proxy service, lets continue with the example from my previous post and create a proxy service for our Currency Converter business service (feel free to follow similar steps for your own business service). In this proxy service we are going to expose a service with the same interface but with a different service (endpoint) address - a simple example but one which demonstrates the concepts and reflects a common business scenario.

The first step is to start a new session so we can make changes which we do by clicking New in Change Center.

Next, using Project Explorer we navigate to the project we created (Adding a service to Oracle Service Bus) and create a new folder called Proxy Services by entering Proxy Services in the Enter New Folder Name box and clicking Add Folder. You should now have a screen that looks like:

folderViewShowingProxyServicesFolder

Move into the newly created directory by clicking on Proxy Services and select the Proxy Service option from the Create Resource drop down.

This is the page where we can name the proxy service, provide a description of it and most importantly describe what type of service it is - whether it is a web service, a messaging service, an XML service or a SOAP service without a concrete interface. Oracle Service Bus also provides a convenient option to create a proxy service based on an existing business service which will create a proxy service with the same interface as the business service. This is the option we are going to use here. Complete the screen as follows:

createProxyService

Note:  To complete the create from existing business service box just select the Browse button and select the business service - CurrencyConverterBS.

Click Next.

On the next screen you will be asked some more questions about your proxy service, such as which protocol should it use (in this case we choose http, the same as the business service), the endpoint URI (this is the service endpoint address we are going to modify) and whether you need access to the header information within the service request (in this case we don't). The completed screen should look like:

createProxyService2

Note: Feel free to set the endpoint URI to something of your choice.

This is all we need to configure for our proxy service so just go ahead and click the Last button and check your summary looks something like:

proxyServiceSummary

Click Save.

So what has happened here? Oracle Service Bus has created a new service for us with the same interface and transport protocol as the original business service, but with a different endpoint address. It has also created a message flow which routes any requests sent to the new proxy service to the backend business service.

Open up the message flow for the newly created proxy service to see how this is done. Using Project Explorer, find the proxy service and then click on the message flow icon (messageFlowIcon ) and you should see something like the simple message flow below:

messageFlow

The CurrencyConverterPS node handles the messages coming into and being emitted by the proxy service and the RouteTo_CurrencyConverterBS handles the routing to the existing business service.  Since this is a simple use case there is just a direct wire between them - in more advanced message flows you would see more complex logic here.

If you left click on the RouteTo_CurrencyConverterBS node and select Edit Route you should see the details of the route node. You can see that you have the ability to add extra actions here that occur on either the request or response, but for this simple example there is no need. Simply check the box to "Use inbound operation for outbound" which does exactly what it says on the tin - uses the inbound operation name as the outbound operation name invoked on the business service. It also forces the SOAPAction field to be set which happens to be required by this backend web service as it is implemented using .NET. Then click Save All to save your changes, and then Activate in the Change Center to enforce your changes to Oracle Service Bus. Make sure you enter a description and click Submit.

You can now test this new proxy service in the same way as my previous post, by clicking on the bug icon in the Actions column. Modify the fromCurrency to GBP and the toCurrency to USD and marvel at how many US dollars you can currently get to the British pound!

In this post, I've hopefully demonstrated how easy it is to expose a new service on the bus. Obviously this is a simple example, but it is a quite often used one and has demonstrated a number of the key concepts. In future posts, I will talk about some more advanced features of the product and provide some tips and also some solutions to some commonly faced problems.

Comments:

When i tries to use dynamic transformation example , i got following error XQuery expression evaluates to an invalid XQuery resource name. The only difference i did, is created project on console and created three directories XSD,Proxy Service, Business Service and all XSLT files are under XSD and project name is given DynamicTransformation. So in xapth query i mentioned fn:concat("DynamicTransformation/XSD/Version",$version) i get error XQuery expression evaluates to an invalid XQuery resource name : DynamicTransformation/XSD/Version1

Posted by Jack on March 20, 2009 at 07:57 AM GMT #

It sounds like your problem may be down to you trying to do this with XSLT and not XQuery resources. Unfortunately this is not yet supported in Oracle Service Bus 10gR3. Hope that helps. Chris

Posted by Chris Tomkins on March 25, 2009 at 07:20 AM GMT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

UK Pre-Sales consultant specialising in business integration.

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today