WSO2 ESB Message JMS Producer Exception: - axis2

I have Created a queue named NewJMSQueue in ActiveMQ, using ActiveMQ management console.
I am trying to produce a message in this queue using WSO2 ESB message producer. Below are the source of my producer.
<proxy xmlns="http://ws.apache.org/ns/synapse" name="JmsProducerTest" transports="http" statistics="disable" trace="disable" startOnLoad="true">
<target>
<inSequence>
<log level="full"/>
<property name="OUT_ONLY" value="true"/>
<send>
<endpoint>
<address uri="jms:/NewJMSQueue?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://localhost:61616&transport.jms.DestinationType=queue"/>
</endpoint>
</send>
<property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/>
<log level="full"/>
</inSequence>
<outSequence>
<send/>
</outSequence>
</target>
<publishWSDL uri="file:repository/samples/resources/proxy/sample_proxy_1.wsdl"/>
<description></description>
</proxy>
but i am getting following ERROR in WSO2 ESB console
[2013-09-20 11:37:51,777] ERROR - BaseUtils JNDI lookup of name dynamicQueues/NewJMSQueue returned a org.apache.activemq.command.ActiveMQQueue while a
interface javax.jms.Destination was expected
[2013-09-20 11:37:51,777] ERROR - Axis2Sender Unexpected error during sending message out
org.apache.axis2.transport.base.BaseTransportException: JNDI lookup of name dynamicQueues/NewJMSQueue returned a org.apache.activemq.command.ActiveMQQ
ueue while a interface javax.jms.Destination was expected
at org.apache.axis2.transport.base.BaseUtils.handleException(BaseUtils.java:167)
at org.apache.axis2.transport.jms.JMSUtils.lookup(JMSUtils.java:522)
at org.apache.axis2.transport.jms.JMSUtils.lookupDestination(JMSUtils.java:718)
at org.apache.axis2.transport.jms.JMSOutTransportInfo.getDestination(JMSOutTransportInfo.java:184)
at org.apache.axis2.transport.jms.JMSOutTransportInfo.loadConnectionFactoryFromProperties(JMSOutTransportInfo.java:132)
at org.apache.axis2.transport.jms.JMSOutTransportInfo.createJMSSender(JMSOutTransportInfo.java:330)
at org.apache.axis2.transport.jms.JMSSender.sendMessage(JMSSender.java:124)
at org.apache.axis2.transport.base.AbstractTransportSender.invoke(AbstractTransportSender.java:112)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
at org.apache.axis2.description.OutOnlyAxisOperationClient.executeImpl(OutOnlyAxisOperation.java:297)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
at org.apache.synapse.core.axis2.Axis2FlexibleMEPClient.send(Axis2FlexibleMEPClient.java:456)

I have added following jar files. geronimo-j2ee-management_1.1_spec-1.0.1.jar, geronimo-jms_1.1_spec-1.1.1,jar hawtbuf-1.9.jar, activemq-broker-5.8.0.jar, activemq-client-5.8.0.jar, activemq-all-5.8..
once i removed activemq-all-5.8.0.jar it is working fine.

Related

WSO2 EI with RabbitMQ - how to reject a message?

Using WSO2EI 6.4.0 with RabbitMQ as inbound transport as described in the documentation RabbitMQ AMQP Transport.
Seems working well, though there's only the "sunny day" scenario covered.
Requiring preserving the message ordering, on exception we cannot just requeue the message back to the queue. If the backend service is not available, I'd like to rollback the message and attempt to process the message later. As far I understood we need to send the nack response.
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="test_mgs_processing_proxy"
startOnLoad="true"
statistics="disable"
trace="disable"
transports="http,rabbitmq,local">
<target>
<inSequence>
<log level="full">
<property name="step" value="test_mgs_processing_proxy"/>
</log>
<property name="OUT_ONLY" value="true"/>
<!-- simulate an exception has occured -->
<property name="SET_ROLLBACK_ONLY" scope="axis2" value="true"/>
<payloadFactory media-type="xml">
<format>
<step xmlns="">test_mgs_processing_proxy</step>
</format>
<args/>
</payloadFactory>
</inSequence>
</target>
<parameter name="rabbitmq.exchange.name">amq.topic</parameter>
<parameter name="rabbitmq.queue.name">app_a</parameter>
<parameter name="rabbitmq.connection.factory">AMQPConnectionFactory</parameter>
<description/>
</proxy>
Setting FORCE_SC_ACCEPTED makes the message considered as consumed. Even if we set the SET_ROLLBACK_ONLY property, the message stays in the NACK state and is not resent (at least no quickly).
Question - using the RabbitMQ AMQP Transport, is there a way to configure redelivery interval of not-processed messages?
Seems like it is an issue in WSO2 EI 6.4.0. https://github.com/wso2/product-ei/issues/4739
The issue is not there when you use Inbound Endpoints. The issue is there only when you use a Proxy with rabbitmq transport.

Method not allowed in wso2 esb

I need to add api service using wso2 api management or wso2 ei. i have a web api with ip:port format that have response via postman but when i add web api in api manager or wso2 ei in api menu and call published api via postman i get this error
method not allowed and in log i have this error : main sequence executed for call to non-existent = /CardTransfer/
my API Source :
<api xmlns="http://ws.apache.org/ns/synapse" name="NoorService" context="/CardTransfer" version="v1" version-type="url">
<resource methods="POST">
<inSequence>
<log level="full">
<property name="befor" value="befor"/>
</log>
<send>
<endpoint>
<http uri-template="http://x.x.x.x:9110/"/>
</endpoint>
</send>
<log level="full">
<property name="after" value="after"/>
</log>
</inSequence>
<outSequence>
<send/>
</outSequence>
</resource>
</api>
The request URL for the API resource you have created is:
https://<ip>:<port>/CardTransfer
the forward slash end of the API context should be omitted.
If the API resource contains a url-mapping="/", the request URL would be:
https://<ip>:<port>/CardTransfer/

About messageType and JIRA connector

I have two proxy services for testing purpose that connects with JIRA using JIRA Connector. First one, accepting "application/json" payload:
<proxy name="PruebaJIRA_01" startOnLoad="true" trace="disable" transports="https http">
<description/>
<target>
<inSequence>
<log level="full"/>
<jira.init>
<username>xxxxxx</username>
<password>xxxxxx</password>
<uri>http://gea-jira.its.ute.com/jiragea</uri>
</jira.init>
<property expression="json-eval($.consulta)" name="query"/>
<jira.searchJira>
<query>{$ctx:query}</query>
</jira.searchJira>
<log level="full"/>
<respond/>
</inSequence>
</target>
</proxy>
The second one, accepting "text/xml" payload:
<proxy name="PruebaJIRA_02" startOnLoad="true" trace="disable" transports="https http">
<description/>
<target>
<inSequence>
<property name="messageType" scope="axis2" value="application/json"/>
<log level="full"/>
<jira.init>
<username>xxxxxx</username>
<password>xxxxxx</password>
<uri>http://gea-jira.its.ute.com/jiragea</uri>
</jira.init>
<property expression="//root/consulta" name="query"/>
<jira.searchJira>
<query>{$ctx:query}</query>
</jira.searchJira>
<log level="full"/>
<respond/>
</inSequence>
</target>
</proxy>
It seems that JIRA connector only accept JSON incoming data, so in the second one I have a "messageType" conversion at the top of the sequence.
Both services run OK, but the question is: Why is the second proxy working if I am using an xpath expression?
I am using wso2 ESB 4.9.0.
Thanks in advance.
ESB receives disparate message formats from different clients and systems, because of this ESB required a canonical message format inside the ESB to do all the message mediation tasks. Because of this the message builder used to convert the incoming messages into a canonical format. The canonical format using inside the ESB is SOAP. So surely your XPATH expression works with the soap message.
MessageType property used to select correct message formatter and the message formatter is used to build the outgoing stream from the proxy.
More Info - demystifying-wso2-esb-pass-through-transport /
Working with Message Builders and Formatters

Getting error while transferring Data/response from HTTP to UDP protocol through Axis2 webservice in WSO2 ESB

I am new to WSO2 ESB and stuck with one problem of Transport level information does not match with SOAP Message namespace URI.
Actually i want to transfer request/message through UDP transport, for that i have created a Proxy service which transfers request to actual web service through UDP transport.
it seems like :
<proxy xmlns="http://ws.apache.org/ns/synapse" name="example1"
transports="https http udp"
startOnLoad="true"
trace="disable">
<target>
<inSequence>
<log level="full"/>
<send>
<endpoint>
<address uri="udp://192.168.6.200:3333/services/xyzService?contentType=application/soap+xml">
<enableAddressing separateListener="true"/>
</address>
</endpoint>
</send>
</inSequence>
<outSequence>
<log level="full" />
<send/>
</outSequence>
</target>
<publishWSDL uri="file:repository/WSO2-ws/ABC.wsdl"/>
</proxy>
Other Service get message/request through UDP and transfer to actual WebService.
it seems like:
<proxy xmlns="http://ws.apache.org/ns/synapse" name="example2" transports="udp"
startOnLoad="true"
trace="disable">
<target>
<endpoint>
<address uri="http://192.168.6.200:8280/services/abc-demo"/>
</endpoint>
<outSequence>
<log level="full"/>
<send />
</outSequence>
</target>
</proxy>
while transferring the Response back to UDP from actual WebService its thrown error like :
[2013-11-26 15:06:47,375] ERROR - ProcessPacketTask Error during processing of datagram:
org.apache.axiom.soap.SOAPProcessingException: Transport level information does not match with SOAP Message namespace URI
at org.apache.axis2.builder.BuilderUtil.validateSOAPVersion(BuilderUtil.java:745)
at org.apache.axis2.builder.SOAPBuilder.processDocument(SOAPBuilder.java:58)
at org.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:180)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:146)
at org.apache.axis2.transport.base.datagram.ProcessPacketTask.run(ProcessPacketTask.java:63)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
I haven't any idea why it's happened ??
Please suggest me if am doing in wrong way or some configuration are not done properly.
Any help is greatly appreciated.
I look forward to hearing from you soon.
Follow this sample which shows switching between UDP and HTTP.
As mentioned in there, you need to add the UDP listener and sender configuration to <ESB_HOME>/repository/conf/axis2/axis2.xml file.
<transportReceiver name="udp" class="org.apache.axis2.transport.udp.UDPListener"/>
<transportSender name="udp" class="org.apache.axis2.transport.udp.UDPSender"/>
And specify the UDP listening port and content type in the proxy service.
<parameter name="transport.udp.port">9999</parameter>
<parameter name="transport.udp.contentType">text/xml</parameter>

WSO2 ESB - Proxies do not work when Soap Tracing is turned off

I have downloaded and I am trying out the WSO2 ESB and setting up proxies for WCF services with wsHttpBindings. When I have Soap Tracing enabled everything works fine - when I turn it off I get a 500 internal server error every time. I am completely stuck with this and can't understand why this would be.
I have tried setting up both pass through proxies and WCF based proxies and I always have the exact same issue - with Soap Tracing enabled everything looks great and works perfectly. If I turn it off and otherwise don't touch anything I get a 500 error:
System.ServiceModel.ProtocolException: An HTTP Content-Type header is required for SOAP messaging and none was found. ---> System.Net.WebException: The remote server returned an error: (500) Internal Server Error.
I have tried it with a basicHttpBinding and it seems to work fine with Soap Tracing on or off. The problem seems to just be with wsHttpBindings.
Here is the full source for the proxy:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="ContactService"
transports="http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<outSequence>
<send/>
</outSequence>
<endpoint>
<wsdl service="ContactService"
port="ContactService_WsHttp"
uri="http://localhost/Actions/ContactService.svc?singleWsdl"/>
</endpoint>
</target>
<publishWSDL uri="http://localhost/Actions/ContactService.svc?singleWsdl"/>
<description/>
</proxy>
can you please try with in the inSequence of the proxy that your are using?
thank you,
1G
I am having the same issue, here is the proxy that is having issues:
<proxy name="cx.partner.usps.RateV4"
transports="https http"
startOnLoad="true"
trace="disable">
<description/>
<target>
<inSequence>
<property name="CONTENT_TYPE"
value="application/xml"
scope="axis2-client"
type="STRING"/>
<property name="FORCE_HTTP_1.0" value="true" scope="axis2"/>
<log level="full"/>
<send>
<endpoint key="partner.usps.prd.endpoint"/>
</send>
</inSequence>
<outSequence>
<class name="cx.wso2.mediators.addNamespace">
<property name="soapPartName" value=""/>
<property name="nsToAdd" value="http://xmlns.usps.com"/>
</class>
<send/>
</outSequence>
</target>
<publishWSDL key="conf:/esb-resources/wsdl/usps/RateV4.wsdl">
<resource location="RateV4.xsd" key="conf:/esb-resources/schema/usps/RateV4.xsd"/>
</publishWSDL>
This was working without tracing on 3.x, but after migrating to 4.7 I have to enable the SOAP tracer.
Try this, it worked for us:
<parameter name="enforceWSAddressing">true</parameter>