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

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>

Related

WSO2 ESB : UDP to HTTP transform

I am trying to convert UDP messages to HTTP in a high performance manner. So I thought about doing it with WSO2 ESB.
So I tried sample tutorial https://docs.wso2.com/pages/viewpage.action?pageId=26838866
And sample works well.
So then I tried to call to the ESB proxy with a UDP message generation tool (packetsender). But there I can't send just a string value as the UDP message and I have to send full soap message with each UDP message. i.e
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<m0:placeOrder xmlns:m0="http://services.samples">
<m0:order>
<m0:symbol>IBM</m0:symbol>
</m0:order>
</m0:placeOrder>
</soapenv:Body>
</soapenv:Envelope>
So is it possible to all this endpoint with UDP message that only have string (without sending whole SOAP information)? May be there we might need to change the following proxy service of ESB,
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="UDPProxy"
transports="udp"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<log level="full"/>
<property name="OUT_ONLY" value="true"/>
</inSequence>
<endpoint>
<address uri="http://127.0.0.1:9764"/>
</endpoint>
</target>
<parameter name="transport.udp.port">9998</parameter>
<parameter name="transport.udp.contentType">text/xml</parameter>
<description/>
</proxy>
Thanks
Modify your proxy def and adapt content type to your need :
<parameter name="transport.udp.contentType">text/plain</parameter>

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

How to call a secure proxy service via simple proxy service in WSO2 ESB

I have made a secure proxy service in WSO2 ESB. I followed this tutorial.
Now i want to call this service by using another proxy service. But when i send request from SoapUI to simple proxy service, i encountered an error. What i am unable to figure out is that how to pass security configurations to the proxy service.
Note: I am using WSO2 ESB 4.8.1.
Secure Proxy Service Code:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="EchoProxy2"
transports="https,http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<log level="full" separator="InSequence Log"/>
</inSequence>
<outSequence>
<log level="full" separator="Out Sequence Called"/>
<send/>
</outSequence>
<endpoint>
<address uri="http://wi1-Inspiron-3521:8280/services/echo"/>
</endpoint>
</target>
<parameter name="disableREST">true</parameter>
<parameter name="ScenarioID">scenario2</parameter>
<enableSec/>
<policy key="conf:/repository/axis2/service-groups/EchoProxy2/services/EchoProxy2/policies/SigOnly"/>
<description/>
</proxy>
Simple Proxy Service Code:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="CallEchoProxy"
transports="https,http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<log level="full" separator="*Calling Proxy In Sequence"/>
</inSequence>
<outSequence>
<log level="full"
separator="Calling Proxy Out Sequence"/>
</outSequence>
<endpoint>
<address uri="http://wi1-Inspiron-3521:8280/services/EchoProxy2"/>
</endpoint>
</target>
<description/>
</proxy>
Error in Logs:
[2015-02-19 11:22:48,718] ERROR - ServerWorker Error processing POST request for : /services/EchoProxy2
org.apache.axis2.AxisFault: Missing wsse:Security header in request
at org.apache.rampart.handler.RampartReceiver.setFaultCodeAndThrowAxisFault(RampartReceiver.java:180)
at org.apache.rampart.handler.RampartReceiver.invoke(RampartReceiver.java:99)
at org.apache.axis2.engine.Phase.invokeHandler(Phase.java:340)
at org.apache.axis2.engine.Phase.invoke(Phase.java:313)
at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:261)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:167)
at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:411)
at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:183)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: org.apache.rampart.RampartException: Missing wsse:Security header in request
at org.apache.rampart.RampartEngine.process(RampartEngine.java:146)
at org.apache.rampart.handler.RampartReceiver.invoke(RampartReceiver.java:92)
... 10 more
Problem:
I am unable to understand that how to pass security configurations to my simple proxy Service.So that it can communicate with the Secure Service and get back the response.
You have a secured proxy and also you have un-secured proxy. When you sent message to un-secured proxy, it must call the secured proxy. So, your un-secured proxy must call the secured end point. Here, secured end point is your secured-proxy. To call a secured end point, you must attached a WS-Security policy in to the end point configuration. You refer this blog which explains how to call an secured end point. If you follow the steps correctly, i guess you can resolve this issue.

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>

WSO2 ESB Message JMS Producer Exception:

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.