SOAP over JMS with Oracle Service Bus 11g

Bookmark and Share
In a previous blog I already showed you how you can do SOAP over JMS with a JAX-RPC Web Service. In this blogpost I will use OSB 11g ( Also works in 10.3 ). The OSB Proxy Services is also based on the JAX-RPC framework, so it works almost the same as a normal Java JAX-RPC Service.



You need to start with a new Proxy Service based on a WSDL



Choose for JMS. OSB will generates a default Endpoint Uri. You need to remember the QueueName of this Endpoint uri, you will use this in your Java proxy client.

OSB automatically creates a new Queue with this name when it does not already exists.



In the JMS Transport tab you need to select Is Response Required and JMSMessageID as Response Pattern.



In the Message Flow Tab I will use a simple File Busines Service and in the Response Action an Assign to set the WSDL response in the body variable.

In the Response Action you need add a Transport Header.



In the Transport Header you need to add the _wls_mimehdrContent_Type Header with as value 'text/xml; charset=utf-8' and use Inbound Response as Direction.

If you don't set this Transport Header you can get a content type null error on the JAX-RPC Client side

Deploy this project to the OSB Server.



Now you can download the WSDL of the Proxy Service in the SB Console, you need this to generate the JAX-RPC Client.



extract this jar and optional you can change the Endpoint to this Uri jms://servername:7001?URI=JMSProxyServiceRequest . Change the servername, the port number and change the Queue name.  That's enough to find the Queue.



The last step is to generate a Java Web Service Proxy client. Please read this blogpost how to generate a client.

This is the ANT Target I used to generate the client classes based on the WSDL

<target name="clientOSB">
<clientgen wsdl="file:/c:/temp/jms/HelloworldNormal.wsdl"
destdir="src" 
packagename="nl.whitehorses.clientosb.jms"
type="JAXRPC"/>
<javac srcdir="src" 
destdir="classes"
includes="nl/whitehorses/clientosb/jms/**/*.java"/>
</target>


And the java test client. If you change the WSDL Endpoint you don't need to set JmsTransportInfo

package nl.whitehorses.clientosb.jms;

import java.net.URISyntaxException;

import java.rmi.RemoteException;

import javax.xml.rpc.ServiceException;
import javax.xml.rpc.Stub;

import weblogic.wsee.connection.transport.jms.JmsTransportInfo;

public class TestService {

public TestService() {
}


public static void main(String[] args) {

try {
HelloWorldServiceSoapHttpPortBindingQSService hello = new HelloWorldServiceSoapHttpPortBindingQSService_Impl();
HelloWorldService port = hello.getHelloWorldServiceSoapHttpPortBindingQSPort();

String uri = "jms://laptopedwin:7001?URI=JMSProxyServiceRequest";  
JmsTransportInfo ti =  new JmsTransportInfo(uri);  
((Stub)port)._setProperty("weblogic.wsee.connection.transportinfo", ti);  

System.out.println(port.sayHello());

} catch (ServiceException e) {
e.printStackTrace();
} catch (RemoteException e) {
e.printStackTrace();
} catch (URISyntaxException e) {
e.printStackTrace();
}
}

}




{ 0 comments... Views All / Send Comment! }

Post a Comment