Oracle Service Bus, JMS Request/Response pattern

Inspired by the article of Edwin about JMS Request Reply Interaction Pattern in Soa Suite 11g, i will show a little example of what functionality Oracle Service Bus supplies to implement the jms request/response (reply) pattern.
The solution is quiet simple.

Create the wls resources

  • Create JMS Server, MyJMSServer
  • Create JMS Modules, MyJMSResources
  • Create a Connection Factory, MyConnectionFactory
  • Create 2 queues, MyQueueIn (request message), MyQueueOut (response message)


Create the osb resource

  • Create a new proxy service, JMSRequestResponsePS
  • ps_1
    For the Endpoint URi, insert the url to In-queue
    Check the ‘Is Response Required’ option.
    We will use JMSCorrelationID for the Response Correlation Pattern.
    For the Response URI, insert the url to the Out-queue

Now test the flow by insert a little xml message in the MyQueueIn queue, wait a few seconds and check the MyQueueOut queue.
Only thing what’s left is to fill in the message flow of the proxy service and add some logica.

Original blog

Share this Post:
Digg Google Bookmarks reddit Mixx StumbleUpon Technorati Yahoo! Buzz DesignFloat Delicious BlinkList Furl

17 Responses to “Oracle Service Bus, JMS Request/Response pattern”


Hi eric, very useful post, I have another case, I must listen from one queue then forward every message to two different queue, how could I do that?, Now I already made one business service, but it only forward to one queue only.

Really thanks in advance.

Eric Elzinga | May 2nd, 2010 at 8:55 am

So all messages must be forwarded to both queues? (duplicated?)


yeahh…it’s completely true..


additional info : in my case, osb need to listen that queue and forward it to multiple application (with different queue too), who consumes the same message for different needed.

any suggestion?

Eric Elzinga | May 2nd, 2010 at 9:25 am

Since you don’t need any logic based on the messages, i would say you could make us of the ‘Store-And-Forward’ mechanisme in the Weblogic Server itself. See this :

Is that what you need? Don’t think you need osb in here, since you you don’t execute logic on the messages. If you do want to let all the messages get processed by some OSB process, you could always use a for-each loop and do several service call outs in it. So you don’t route to the business service but you do several call outs,depending on the amount of the ‘consumers’ you have.


Hi eric, thanks for your aid, I prefer publish to service callout, and it works great now…

I think the best approaching is using SAF but I’m still learning on it :d.




Hi, I’m new in JMS and OSB and testing this scenario.
Could you write for me sample test message for MyQueueIn?



We have a requirement to consume message from JMS queue once in a day . I thought of using JMS request -reply.
I have another BPEL process publishing messages to Sample queue.

Another BPEL which will be invoked by Scheduler I have implemented JMS request reply but the problem is to the Sample queue. I am only getting the message back which I am sending using Invoke activity and not getting message published by another BPEL to Sample Queue.

Can you please help?


So in the sample queue you only find the messages which get stored directly by use of your ‘first’ bpel process. And the messages which should get stored from the bpel which is called by the scheduler won’t get stored in the queue. Correct ?


Hello Eric, Your posts are really helpful.
I have a question, can we publish the POJO object returned by java callout to Messaging service to publish onto queue.

My requirement is:

1) Process the request and build a POJO object (this i can do using java callout and return pojo stored in variable in message flow)

2) Have to Publish the POJO object to JMS Queue as object message (for this i have written service to put on queue. I am replacing the body content with .

This shows publishing successful, but null object is placed on queue.

Can you please suggest.


I haven’t tested this myself i must say. In this blog i only tested the receive part of the java object.

When you inspect the $body in the publish activity with the osb debugger, do you see content in it ? or when you use the java object as input for some dummy java callout, is the object itself not empty ?


Hello Eric, thanks for immediate response…I see the body content replaced with java-content ref=…… etc.

In my Proxy Message flow, i am replacing the body content with below, and invoking the Publish activity(to call business service which is of type Message Service with request type as Java, and Response as None). Here pojoObj is the Response of Java Callout and i am storing as this variable.

ctx:java-content ref=’pojoObj’ xmlns:ctx=””

My question : Is this right way of invoking and replacing body content ??
Appreciate if you can give steps for publishing the POJO object to queue using OSB proxy or business service. i am suspecious on the ctx:java-content usage.


Finally i got this working.

I have to check the “Return as Reference parameter” checkbox on the Java Callout.
And assigned Return Value to variable “pojoObj”

And I replaced the $body/* with $pojoObj

This is worked, OSB automatically storing the object in cache and assigned as

When i refer the object with $pojoObj the above con:java-content is replaced in the body.

Earlier i tried to replace the body content using the ref:jcid:pojoObj this is wrong.

I just have to use the variable $pojoObj, this refers the cached obj in pipeline.

Anyways thanks..


Hi Eric, Your posts are really helpful. I’m testing with text messages in queues. The message has two parts separated by the “Pipe”. How do I define and assign the structure of the message with variables? Such that when it will read the message, each part is assigned to the corresponding variable. For example the following message: “serviceA|Hello serviceA”.
I am using OSB 11g version, WebLogic Server version, OEPE version 3.7.1


Hi Arturo,

You could use 2 assigns and use the function substring-before, substring-after to assign those values to your 2 variables?


Please add me to the group

Leave a Reply:

Name (required):
Mail (will not be published) (required):
Comment (required):
XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>