Oracle Service Bus: Flat file to JMS routing with Xquery transformation

1. Login into Weblogic console http://localhost:7021:console. JMS Modules -> JMS resources and create a new JMS queue “File2JMS_BSRequest” Select the subdeployment as “wlsbJMSServer”

2. Create new Oracle Service Bus configuration project and then new OSB project.


3. Drag and drop the two schema files into the OSB project (File2jms) in WebLogic workshop IDE.

With the source and target schema impoerted, create a new xquery file in Oracle Service Bus and map the source and target field.

File2JMS -> New “XQuery Transformation”


Select the source and target, xml to xml mapping in the XQuery Transformation.


4. Create a new business service.

Select service as messaging service, message type as xml [do not use browse button leave it empty], and select transport as jms.

In the transport confifuration, select jms as the protocol. Map the endpoint URI to jms queue.


In the JMS transport page, select Queue as the destination type and set the message type to ‘text’.

5. Create a new proxy service called ‘FileRoute.proxy’.


Select service as messaging service, message type as xml [do not use browse button leave it empty], and select transport as file.

Create 2 folders in your C drive, ‘newdir’ and ‘stagedir’.


Set the polling interval to 5 seconds and set the staging directory.


Go to the message flow tab, from the design palette drag and drop Route activity into the process flow diagram after FileRoute activity.

Drag and drop routing activity after the route node. (Select from Route Action – Communication->Routing)

We need to add 2 assign and 1 insert activity.
Drag and drop Assign activity from the design palette into the Request Action pipeline.

Browse the Xquery template, drag and drop the SourceCustomer from the variable structure.


Enter ‘xml’ in the vairable field.

In the second assign activity, enter ‘
’ , in the expression field and set variable field to ‘body’.

In the insert activity, copy the content of the xml variable to the body variable



Click on the Routing activity in the process diagram and select the business service.

6. Deploy the OSB_Config project to the Weblogic Server and goto the OSB Console to execute the process.

7. Goto the Weblogic JMS monitoring console to the see output with concatenated message.


JDeveloper 11g – Creating PL/SQL Webservice and deploying to Weblogic Server

You can expose PL/SQL stored procedures as Webservice via JDeveloper(which wraps the PL/SQL code into Java wrapper), and you can deploy it into weblogic server.

1. Open JDev 11g and create a database connection to HR schema(a sample schema that contains the PL/SQL procedure).


2. Create a generic application PL_SQL_WS and project name GetEmployee.


3. From the database connnection navigator right click the PL/SQL package and publish as webservice. Click next and accept the default


4. Accpet the default and start once finished start the Weblogic Server, here im using the embedded weblogic server in the JDeveloper 11g.

5. Login into Weblogic console and create a datasource connection.

Name – hrconnDS
JNDI Name – jdbc/hrconnDS
Donforget to DS suffix.

6. Deploy the application to the Weblogic Server from JDeveloper11g.

7. Test the Webservice from Weblogic console, through the Weblogic test client.

Calling BPEL process from JSP

Use the HelloWorld BPEL process in the /samples/tutorials folder. Deploy the BPEL process using obant command.


HelloWorld BPEL Process


<%@ page import=””%>
<%@ page import=””%>
<%@ page import=””%>
    <meta http-equiv=”Content-Type” content=”text/html; charset=windows-1252″/>
  String name = request.getParameter(“name”);
  if (name == null)
  name = “BPEL”;
  String xml = “<name xmlns=\”\“>” + name + “</name>”;
    Locator locator = new Locator(“default”,”bpel”);
    IDeliveryService deliveryService = (IDeliveryService)locator.lookupService(IDeliveryService.SERVICE_NAME );
    NormalizedMessage nm = new NormalizedMessage( );
    nm.addPart(“payload”, xml );“HelloWorld”, “initiate”, nm);
    out.println(“BPELProcess HelloWorld initiated!”);


Use obant to deploy the jsp file.