Reputation: 160
I am using wso2esb4.7.0 and ActiveMQ5.8.0 http://docs.wso2.org/display/ESB470/ESB+as+a+JMS+Producer and http://docs.wso2.org/display/ESB470/ESB+as+a+JMS+Consumer according to the document i have done my messages are passing well to queue.Even storing also well .While conuming the messages in to the queue Wso2esb giving issues like formats
ERROR - JMSMessageReceiver Unknown error processing message
org.apache.axiom.om.OMException: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '{' (code 123) in prolog; expected '<'
at [row,col {unknown-source}]: [1,1]
why this happening is there any message format issue i am passing just sample json like
curl -v -H "Accept: application/json" -H "Content-Type:application/json" -H "ModifiedOn:0" -H "username:vikaash|21405735755158656" -H "password:gbin" -d '{"name":"youtility tech","mail":"[email protected]"}' http://youtility2-desktop:8282/services/JmsStore
how we can send response to client
http://stackoverflow.com/questions/18440789/how-to-give-a-response-to-client-using-wso2esb-jmsqueue
Upvotes: 1
Views: 535
Reputation: 281
Reason for this is, if you haven't specifically configure JMS Proxy to accept messages in a particular message format, it will always treat messages are in the text/xml format.
So when you send the message in application/json format you will get this exception while building the message. So if you want to accept messages in json format from a JMS queue you have to define 'transport.jms.ContentType' parameter as follows in the proxy service configuration.
<parameter name="transport.jms.ContentType">
<rules>
<jmsProperty>contentType</jmsProperty>
<default>application/json</default>
</rules>
</parameter>
Following is a sample proxy configuration.
<proxy name="StockQuoteProxy" 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>
<publishWSDL uri="file:repository/samples/resources/proxy/sample_proxy_1.wsdl"/>
<parameter name="transport.jms.ContentType">
<rules>
<jmsProperty>contentType</jmsProperty>
<default>application/json</default>
</rules>
</parameter>
</proxy>
Upvotes: 2