retrieve corelationId of JMS message in wso2 esb - wso2

I have created a queue in activeMQ and also created a proxy service which is listening for messages on that queue.
While testing, I have put up a sample message to ActiveMQ queue using the console provided by ActiveMQ and set its corelationId but I am unable to retrieve the same corelation ID in the proxy service.
Below is the proxy code to retrieve the same.
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="JMSQueueConsumer"
transports="jms"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<log level="custom">
<property name="corelationId" expression="get-property('JMS_COORELATION_ID')"/>
</log>
<property name="OUT_ONLY" value="true" scope="default" type="BOOLEAN"/>
</inSequence>
</target>
<parameter name="transport.jms.Destination">WSO2InQueue</parameter>
<description/>
</proxy>
In the logs I am getting the value of "corelationId" as null.
Can anybody help me on this?

you will find this corelationId in the transport scope :
get-property('transport','JMS_COORELATION_ID')

Related

javax.naming.NameNotFoundException: Name [dynamicQueues/myqueue] is not bound in this Context. Unable to find [dynamicQueues]

I've created JMS sender in WSO2 ESB 4.9.0 as below and configured JMS sender in axis2.xml file. I'm getting the below exception when I run the proxy service. Using Websphere MQ JMS queues.
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="StockQuoteProxy"
transports="http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<property name="OUT_ONLY" value="true"/>
<send>
<endpoint>
<address uri="jms:/myquue?transport.jms.ConnectionFactory=ConnectionFactory"/>
</endpoint>
</send>
</inSequence>
<outSequence>
<send/>
</outSequence>
</target>
<description/>
</proxy>
javax.naming.NameNotFoundException: Name [dynamicQueues/myqueue] is not bound in this Context. Unable to find [dynamicQueues]
In my scenario using the WSO2 MB, the correct endpoint it´s this:
<address uri="jms:/MyQueue?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.wso2.andes.jndi.PropertiesFileInitialContextFactory&java.naming.provider.url=repository/conf/jndi.properties&transport.jms.DestinationType=queue"/>
Your proxy config use:
<property name="OUT_ONLY" value="true"/>
So, no response is sent to the client.
You need to specify a WSDL in the proxy config with an operation that does not have a response message or return a status = 200 with:
<property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/>

WSO2 ESB - WSAddressing Set To Header

I am trying to get WSO2 to work with WCF - WCF expects the WSAddressing headers to be set and correct. I am trying to use a Header Mediator with my WSDL Proxy Service and to set the To Header but it never seems to do anything - I always get the error message from WCF: "The message with To '' cannot be processed at the receiver, due to an AddressFilter mismatch at the EndpointDispatcher. Check that the sender and receiver's EndpointAddresses agree."
Here is my proxy setup - what do I need to do to get this working?
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="PingService"
transports="http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<header xmlns:a="http://www.w3.org/2005/08/addressing"
name="a:To"
scope="default"
value="http://localhost/PingService/PingService.svc"/>
</inSequence>
<outSequence>
<send/>
</outSequence>
<endpoint>
<wsdl service="PingService"
port="AccountService_WsHttp"
uri="http://uk-dev-10706.wintech.local/PingService/PingService.svc?singleWsdl"/>
</endpoint>
</target>
<description/>
</proxy>
I think you can enable "WS-Addressing" for your endpoint.
http://docs.wso2.org/display/ESB480/WSDL+Endpoint
Please try with transport scope may be that will work in your case.
<header xmlns:a="http://www.w3.org/2005/08/addressing"
name="a:To"
scope="transport"
value="http://localhost/PingService/PingService.svc"/>

How to call webservice in WSO2 proxy

how I can call web service inside of proxy? Proxy itself works fine, and I added call of logging web service in "in" sequence. I create call using payload factory + send.
Problem is, that proxy now returns result of this logging web service instead of
what web service should return. There is address end point defined in "out" sequence.
I am using WSO2 ESB 4.6.0.
This is the simple example of calling web service inside of the proxy. You need to up back-end service before create the proxy
<proxy xmlns="http://ws.apache.org/ns/synapse" name="customPro" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
<target>
<inSequence>
<send>
<endpoint>
<address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
</endpoint>
</send>
</inSequence>
<out-sequence>
<send/>
</outSequence>
</target>
<publishWSDL uri="http://localhost:9000/services/SimpleStockQuoteService?wsdl"/>
<description></description>
</proxy>
You need to define web service url within the end-point in tag
As well as, this kind of send mediator return end-point response to outSequence
by default.
You can get good understanding of these if you go through the ESB documentation from following url
http://docs.wso2.org/display/ESB460/Samples
If you need further help, feel free to ask here
There are two ways you can achieve the logs
1. Log ESB incoming and outgoing messages through wire log.
To enable debug mode for wire logs;
- ESB console > Configure > Logging
- Set “org.apache.synapse.transport.http.wire” level to “DEBUG”.
In the log, it indicates >> incoming messages to ESB
<< outgoing messages from ESB
2. Use Logs at the appropriate place
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="TestProxy"
transports="https,http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<log level="full">
<property name="test" value="incomming to ESB-----------------------"/>
</log>
<send>
<endpoint>
<address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
</endpoint>
</send>
<log level="full">
<property name="test" value="outcomming from ESB-----------------------"/>
</log>
</inSequence>
<outSequence>
<log level="full">
<property name="test" value="incomming to ESB-----------------------"/>
</log>
<send/>
<log level="full">
<property name="test" value="outcomming from ESB-----------------------"/>
</log>
</outSequence>
</target>
<publishWSDL uri="http://localhost:9000/services/SimpleStockQuoteService?wsdl"/>
<description/>
</proxy>
If it is resolve your problem, please flag as answered.

WSO2 ESB JMS sample showing vfs transport configuration error

I am trying to implement ESB as a JMS Consumer sample, given at WSO2 ESB documentation.
http://docs.wso2.org/display/ESB470/ESB+as+a+JMS+Consumer
I have followed below steps:
configuring JMS listener and sender in
ESB_Home\repository\conf\axis2\axis2.xml
copied all the jar file as mentioned
created a message queue in ActiveMQ using its web console.
Below is my proxy service code:
<proxy xmlns="http://ws.apache.org/ns/synapse" name="JMStoHTTPStockQuote" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
<target>
<inSequence>
<property name="OUT_ONLY" value="true"/>
</inSequence>
<outSequence>
<send/>
</outSequence>
<endpoint>
<address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
</endpoint>
</target>
<description></description>
</proxy>
But still my proxy service is showing as faulty service. with the message:-
Unable to configure the service JMStoHTTPStockQuote for the VFS transport: Service doesn't have configuration information for transport vfs. This service is being marked as faulty and will not be available over the VFS transport.
As you can see I am not using VFS transport for my service and I have uncommented the code for VFS in axis2.xml but still I am getting this faulty exception.
First of all your proxy configuration is not correct. If you want to listen to a JMS queue, you need to use the jms transport in your proxy service. In the link you have mentioned, the proxy service is given as below.
<proxy xmlns="http://ws.apache.org/ns/synapse" name="JMStoHTTPStockQuoteProxy" transports="jms">
<target>
<inSequence>
<property action="set" name="OUT_ONLY" value="true"/>
</inSequence>
<endpoint>
<address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
</endpoint>
<outSequence>
<send/>
</outSequence>
</target>
</proxy>
Here the transport is "jms". Please try with this config.

How to store the Messages In JMS Queue Using Wso2esb and Activemq

I am using wso2esb4.7.0 and ActiveMQ5.8.0 i wish to store the messages in Queue
for this i try with this code but its not working
i created store which will helpful for storing the messages,my conumeing process has done in JAVA code so i need not worry about the Consuming
if i do it my message will appear in acivemq UI
my config is like this
<messageStore name="JMSQueue" class="org.wso2.carbon.message.store.persistence.jms.JMSMessageStore" xmlns="http://ws.apache.org/ns/synapse">
<parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
<parameter name="java.naming.provider.url">tcp://localhost:61616</parameter>
<parameter name="store.jms.destination">faisal5_Queue</parameter>
<parameter name="store.jms.JMSSpecVersion">1.1</parameter>
<parameter name="store.jms.cache.connection">false</parameter>
</messageStore>
and i am trying to pass the message through the proxy for that i write simple proxy service for that
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="Jms"
transports="https,http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<property name="messageType" value="application/json" scope="axis2"/>
<log level="full"/>
<property name="OUT_ONLY" value="true"/>
<store messageStore="JMSQueue"/>
</inSequence>
<outSequence/>
</target>
<description/>
</proxy>
in this case my queue is not creating in Activemq Why its happening
if i create message process then only my QUEUE is appearing in ActiveMQ UI
will you write sample code for this my scenario is simple i wsih to store my client messages without failure they will consume after the storing process
Your proxy and message store are okay, I tested those.
I think you have not correctly Configure the ESB with ActiveMQ.
Follow this link and place the jars as mentioned and edit the Axis2.xml. Then try with your code. It should work
You can simply use the below config to store messages in activemq.
Since you are not using a message processor, it is no need of making a message store. So you can simple store messages in the queue as follows.
<proxy name="JmsProxyTest"
transports="https http"
startOnLoad="true"
trace="disable">
<target endpoint="jmsEndpoint">
<inSequence>
<property name="OUT_ONLY" value="true"/>
<property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/>
</inSequence>
<outSequence>
<drop/>
</outSequence>
</target>
<endpoint name="jmsEndpoint">
<address uri="jms:/faisal5_Queue?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://127.0.0.1:61616&transport.jms.DestinationType=queue"/>
Also you better check you have configured activemq with esb correctly.
Thanks.