SOAP over JMS with WebLogic

Bookmark and Share
With WebLogic 10.3 you can also do SOAP over JMS instead of HTTP. In this blogpost you will see how you can achieve this with WebLogic JMS and with JDeveloper as IDE. The JMS transport offers the following benefits: reliability, scalability, and quality of service but it does require slightly more overhead and programming complexity than HTTP. And you can't use JAX-WS, JAX-WS on WebLogic can't use any other protocol then HTTP, you need to use JAX-RPC instead. This leads to a second problem, JAX-RPC is not well supported in JDeveloper wizards so you need to use ANT.

First step is to configure JMS. I will show you the steps on the Integrated WebLogic of JDeveloper.

Create a persistent Store. You can use a normal FileStore and target this to the DefaultServer.

Create a JMS Server and use the FileStore and also target this to the DefaultServer.

Create a JMS Module and target this to the DefaultServer.

Create a Sub Deployment ( part of your JMS Module ) and target this to your JMSServer.

Now you can create some resources for this JMS Module. You need to create a Connection Factory and use your Sub Deployment. Create a JMS Queue and also use the same Sub Deployment. The JNDI Names are very important you need this in your JAX-RPC Web Service Class.

The WebLogic JMS part is ready, you can restart the WebLogic Server from JDeveloper and check if you see the JNDI Resources in the DefaultServer ( Go to Servers in the WebLogic Console , Click the DefaultServer, on the top of the page there is a JNDI hyperlink )

In JDeveloper you can create a new Workspace / Project.

Create a new Java Class which will be our JAX-RPC Web Service class. Here you need to add the WLJmsTransport Annotation with the queue and connectionFactory attribute. You can't use the forward slash in the JDNI name so replace this with a dot. The rest is like a normal Web Service in JAX-WS or JAX-RPC.


import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;

import weblogic.jws.WLJmsTransport;
@WebService(portName = "HelloWorldJMSPort",
serviceName = "HelloWorldJMSService")


public class HelloWorld {

@WebResult(name = "result")
public String sayHello(@WebParam(name = "message") String message ) {

return message;
Next step is to deploy this to the WebLogic Server. You need to do this with ANT. Add an empty build file to your project and the Weblogic jar to the ANT classpath.

Open the build.xml and add the following.

<project name="webservices-hello_world" default="all">

<taskdef name="jwsc" classname=""/>

<target name="build-service">
<jwsc srcdir="src" destdir="deploy/helloWorldEar">
<jws file="nl/whitehorses/ws/jms/" type="JAXRPC"/>

<taskdef name="wldeploy" classname=""/>

<property name="wls.username" value="weblogic"/>
<property name="wls.password" value="weblogic1"/>
<property name="wls.hostname" value="localhost"/>
<property name="wls.port" value="7101"/>
<property name="" value="DefaultServer"/>

<target name="deploy">
<wldeploy action="deploy" name="helloWorldEar" source="deploy/helloWorldEar"
user="${wls.username}" password="${wls.password}" verbose="true"

<taskdef name="clientgen" classname=""/>

<target name="client">
<clientgen wsdl="http://${wls.hostname}:${wls.port}/HelloWorldJMSService/HelloWorldJMSService?WSDL"
<javac srcdir="src" 

First step is to make an deployment with the JAXRPC option. Run the build-service target. After that you can run the deploy target.

If everything went well, you can go to the WebLogic deployments. 

 Select the Web Service and go to the Testing Tab. You can't test this Web Service with this Test Client.

 Select the WSDL hyperlink and take a look at the endpoint.

The last part is to test this Web Service. For this you need to generate a Web Service Proxy client. Run the client target in ANT. After that you can make your own TestClient where you will be using these client classes.

package nl.whitehorses.client.jms;

import java.rmi.RemoteException;

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

import weblogic.wsee.jaxrpc.WLStub;

public class TestService {
public TestService() throws RemoteException, ServiceException {

HelloWorldJMSService service = new HelloWorldJMSService_Impl(

HelloWorld port = service.getHelloWorldJMSPort();

Stub stub = (Stub)port;


try {
String result = null;
result = port.sayHello("Hello");
System.out.println("Got JMS result: " + result);

} catch (RemoteException e) {
throw e;


public static void main(String[] args) {
TestService testService;
try {
testService = new TestService();
} catch (RemoteException e) {
} catch (ServiceException e) {

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

Post a Comment