Spice Up Your Oracle Knowledge – SOA EXSite – A Practical View On Oracle ESB

Oracle and Distrilogie are presenting different “Monthly Oracle Partner Training” programs and the first month (September) the focus lies on SOA.
This is a partner-dedicated event aimed at informing the Partner community about Oracle Acquisition strategy and “Best-in-Class” offerings that are critical to meet the customer needs.

My task was to give the partners a practical view on Oracle Enterprise Service Bus using a pre-sales case I’ve worked providing an answer to the customers’ specific technical requirements.

This presentation first gives an insight on the business requirements stated by the customer and then focuses on the business value of ESB for each of these requirements.

  • The first requirement was regarding the ability to work with one General Business Object (GBO) that described the customers’ data model. The answer in ESB is using an XML Schema Definition File (xsd) where we describe the required data in an hierarchical, nested manner. Given the customer the possibility to work with the same object throughout the whole business process.
  • The second requirement ‘How can we make a synchronous call from existing applications to an ESB Service?’ ‘How can we propagate changes to our different systems’? The first answer uses file- and ftp-adapter to bacth-read a CSV file. The file is polled for using the file adapter, format the file in a required format using the transform-functionality of ESB and put this file on the ftp-server of the client. For the second question regarding propagation I’ve given a demo where a JMS queue will listen for new messages. Once a message has been received a call will be made to a procedure on the database to unpack the message and create a new record. In this demo I’ve also mentioned the managed- and non-managed approach when implementing ESB Services which explains the virtualization-features of ESB.
  • The 3d requirement was regarding two-way synchronous services were I’ve integrated the ESB Services with an ADF Faces Web Application. Giving the customer an insight on the ease of integration between Oracle ADF and ESB Services using the data binding layer on Web Services.
  • In the last requirement the customer was curious about the integration-possibilities of web services and database procedures, jobs. The question that popped their mind: ‘Can we schedule a web service call using a database job?’. And this is no hastle at all, not for ESB and not for our Oracle Database. We can use the utl_http-package or utl_dbws-package to call our web service endpoint and the procedure holding the pl/sql functionality will be scheduled using dbms_job.

This demo and presentation gave me and the customers a real practical hands-on experience of Oracle’s Enterprise Service Bus and convinced us of the ease of integration when using such technology.

A pragmatic approach and an open vision using practical demo’s and hands-on sessions is the answer to every Enterprise Integration Challenge.

Securing an ESB Service using OWSM

Recently I was organizing a seminar regarding Oracle Soa Suite and the focus lied on Securing web services and integration.

In my demo I wanted to show the different features of BPEL, ESB and OWSM and of course the ease of integration of these different technologies.

The ame was to secure as well existing web services as the ESB services itself which are called inside my bpel processes.

In this way I can call stand-alone BPEL processes, ESB services and web services or integrate these technologies with eachother when required.

The difficulty of this exercise lies in calling secured soap services inside an ESB Service. Using a gateway we can secure the ESB Services and BPEL Processes used throughout the organization. The external webservices we need to integrate with are secured as well, and these security requirements need to be met by the calling service, which in our case is an existing BPEL Process or an ESB Service.

First lets have a look on how to call a secured external webservice, a partnerlink, in a bpel process. The webservice expects user-credentials to be able to call the webservice, these credentials can be added to the secured webservice using by editing the partnerlink.

Go to the partnerlink and click ‘edit’, go to the 3d tab which is the ‘Property’ tab and add the needed parameters to your webservice call. These parameters will define that credentials are added to the header of the web service call and the username and password which are required in this header. The properties you need to add are shown in the printscreen, for each property you need to define the proper values.
Such as for the wsseHeaders property, you need to define ‘credentials’ to state that the header will contain user credentials. This is standard web service security we’re using.

To be able to add these same credentials to the external web service, which is invoked from an ESB Service now, we need to come up with another solution. In the demo the same integration exercise is defined, once integration of external web service with BPEL and once through integration of ESB Routing Service with a SOAP Service. The only difficulty in the ESB Service is, that we can’t add these properties in a declarative way to the ESB Service. Instead we need to work with transformations to be able to add the credentials to the SOAP Service call.
How can we accomplish this, by adding parameters to the xsl-stylesheet which is used to transform the call that’s being made to the SOAP Service.

Have a look at the screenshot below to have a clear view on the needed parameters to add to the SOAP Service using an xsl-stylesheet in the transformation-property of our ESB Routing Service.

Invoke an ESB Service in your User Interface and display the response of this service

How can you bind an ESB Service in your User Interface and more specifically how can I call an ESB Routing Service and get the Result back in my UI?

Let’s say I’m developing a JSF Application and I want to use my existing ESB Services for my binding layer. The way you bind a webservice inside a JSF Application can be resolved in 2 different ways:

  • Create a Webservice Data Control
  • Create a Web Service Proxy and call the endpoint of the webservice with a valid parameter using for example a backing bean

OK, now I’m able to call an ESB Service but how can I get the response of this service back into my User Interface …

You need to create a two-way ESB Routing Service, meaning you need to define a request- and response-operation in your routing service.
E.g. You’re invoking a select on a table and the resultset needs to be displayed in your UI. In other words you want to show a list of employees in your user interface, and this list is bound to an esb service.

The steps you need to perform to get this working:

  • Create a new ESB Project
  • Define a system/group for you Esb Services (in this way it isn’t published to the default system)
  • Create a Database Adapter where you define a select statement on a given table
  • Define a new Routing Service where you define the request parameter, being the selectInputParameters-tag which is provided in the xsd that was generated for your DB Adapter and the reply parameter of the Routing Service is the collection returned by this same xsd.
  • Publish the ESB Service to your ESB Server

Now you can test this ESB Service to see that the resultset of the database adapter is returned by your routing service.

The next step is to define a UI where we can call this ESB Service, the steps you need to perform:

  • Create a new project and define a new JSF-page in this project
  • Create a Web Service Data Control ‘which can be found in the ‘Business Tier’ categorie of the ‘new gallery’
  • In step 1 you need to define a meaningfull name for the web service and in the URL you need to copy/paste the ‘Concrete WSDL URL’ of your routing service which is available through the ESB Control’. Then click browse to get the methods/operations available in the ESB Service and click next
  • In step 2 you need to choose the operation ‘execute’ and add it to the ‘selected’ area, click next
  • Click finish

Now you’re almost there, you’ve defined the web service data control which let’s you bind your UI to your ESB Service. The last thing you need to do now is to create a jsf-page and drag and drop your object inside the jsf-page:

  • Create a JSF-page
  • Drag-and-drop a PanelPage component inside the JSF page to have a nice lay-out
  • Go to the Control Palette and choose the ‘employees’-collection, your resulting objects of the db adapter, and drag-and-drop it into your jsf page.
  • Choose a table-component to have a nice view of your data

And now it’s show time … run the page in your embedded container and have a look at how esb services can be seamlessly integrated into your UI.

Errors when trying to invoke an ESB Service from BPEL or UI

When you try to invoke an ESB Service from a BPEL Process or from an ADF application you can run into the following error/exception:

Error happened when reading wsdl at “http://localhost:8888/esb/wsil/Fulfillment/OrderFulfillment?wsdl”, because “Failed to read wsdl file at: “http://localhost:8888/esb/wsil/Fulfillment/OrderFulfillment?wsdl”, caused by: java.net.ConnectException. : connect: Address is invalid on local machine, or port is not valid on remote machine”.

What does this error mean, and how can you solve it?
When the Bpel Process or UI tries to access the ESB Service but can’t find the webservice or wsdl these exceptions will be thrown. The first step to perform is to check the connection properties in your Esb Control such as shown in the screen below:


Make sure the VirtualHost and Port are defined correctly, afterwards you can check the Routing Service itself to make sure the endpoint is defined correctly.

Create a demo using EJB 3.0, Toplink and ADF as the UI layer and Bpel and ESB as the back-end layer (through web service invocation) – Episode 1

The case I worked out for my demo application is the following: Create a new person via the UI (using JSF and EJB3.0 as data-layer) and initiate a bpel process for the creation of the person. The bpel process will check if all business requirements were met for the person that needs to be created using Business Rules.
A human task was added to make sure the Personal Manager has approved the new person and finally an ESB was added to actually create the person.
The ESB will transform the person-object, an xml-file, to the specific format I need to be able to insert the person in my db.

During the creation of my demo-project I faced some design problems which I will explain in the following chapters:

The first part of the case was simple, create a UI using EJB 3.0 and ADF Faces using JDeveloper as my IDE.
The UI consists of a ListPersons.jspx – page that lists all existing persons of my persons-db and a link to the CreatePerson.jspx-page. In the CreatePerson.jspx page I will create a new Person and initiate the bpel process from here.

But it wasn’t as simple as I thought … to be able to initiate my bpel process using the EJB-objects I needed to prefetch the sequence-value needed for uniquely identifying the person-object, e.g. the Person.personid. This is needed because the bpel process needs all xml-tags to be filled in. If for example the personid, or firstname isn’t filled in you will get the following exception ‘unexpected null value for literal data’.

To be able to prefetch the id in my EJB i thought I could ‘eagerly fetch’ this id using an annotation in EJB 3.0, but there’s no such annotation available :(

What to do next … fetch the sequence value myself and populate the Person.personID with my sequence-value.

I’ve added a new method in my SessionBean that gets the sequence value from my db-sequence, this method is invoked from my custom-method ‘createPersonObject() which constitutes a valid person-object.

The custom-method to fetch the sequence-value uses the ‘createNativeQuery’-method on the EntityManager:

em.createNativeQuery(“select person_seq.nextval from dual”);

The UI now works correctly, using the createPersonObject()-method as binding-layer to go to the CreatePerson.jspx file.

Now I need to link my existing Bpel Process to this UI … coming up soon …