Vlad K
Vlad K

Reputation: 2851

Mule web service consumer over JMS

I need to consume WS that's using JMS as a transport rather than HTTP. The Web Service Consumer doc says that it supports JMS but no any example provided unfortunately of using the component with non HTTP transports. Need help with this subject. These are the steps I've done:

The wsdl has been successfully loaded by the connector wizard in anypoint. I've specified the method to be called. The parameters were recognized by DataSense so I can see the input parameters with DataMapper etc.

The URL looks like this: jms:queue:toOrderManagement?replyToName=fromOrderManagement?targetService=OrderManagement

I've defined global JMS connector like this:

   <jms:connector name="JMSConnector" specification="1.1"  username="user"
        password="******" validateConnections="true" doc:name="JMS">
        <reconnect-forever />
    </jms:connector>

and associated it with the WS connector like this:

   <ws:consumer-config name="Web_Service_Consumer" wsdlLocation="myOrder.wsdl" 
service="OrderManager" port="JMSOrderManager" 
serviceAddress="jms:queue:toOrderManagement?replyToName=fromOrderManagement?targetService=OrderManagement" 
doc:name="Web Service Consumer" connector-ref="JMSConnector"/>

So, how to specify the actual JMS queue name and what the format of the serviceAddress attribute when it's configured for JMS/WS?

Upvotes: 0

Views: 272

Answers (1)

Vlad K
Vlad K

Reputation: 2851

Ok, it took me some time to get the answer on this. So, first, the format of the servcieAddress should be like this:

jms://${toQueue}?exchangePattern=request-response

where toQueue is the "request" queue name i.e. the one the request will be sent to.

Now, if you don't specify any additional parameters, a temporary "response" queue will be automatically created and WS Consumer will be waiting for receiving the response from it.

If you wanna use a pre-configured queue for getting responses then, before calling the WS Consumer, you need to set the message property JMSReplyTo with the response queue name to be used. If the property is set then WS Consumer will wait for the response from that queue rather than from the temporary one.

Upvotes: 0

Related Questions