NullPointer reference sending message on RabbitMQ transport - wso2

When sending from ESB 4.9.0 API to RabbitMQ with this transport string:
<send>
<endpoint>
<address name="scalehouse_001_rabbitmq" trace="enable" uri="rabbitmq:/ScaleHouses?rabbitmq.server.host.name=localhost&rabbitmq.server.port=5672&rabbitmq.server.user.name=guest&rabbitmq.server.password=guest&rabbitmq.queue.name=scalehouse_001"/>
</endpoint>
</send>
I get this error:
java.lang.NullPointerException at org.apache.axis2.transport.rabbitmq.RabbitMQMessage.<init>(RabbitMQMessage.java:43) at org.apache.axis2.transport.rabbitmq.RabbitMQSender.sendOverAMQP(RabbitMQSender.java:84) at org.apache.axis2.transport.rabbitmq.RabbitMQSender.sendMessage(RabbitMQSender.java:72) at org.apache.axis2.transport.base.AbstractTransportSender.invoke(AbstractTransportSender.java:112) at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442) at org.apache.synapse.core.axis2.DynamicAxisOperation$DynamicOperationClient.send(DynamicAxisOperation.java:185) at org.apache.synapse.core.axis2.DynamicAxisOperation$DynamicOperationClient.executeImpl(DynamicAxisOperation.java:167) at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149) at org.apache.synapse.core.axis2.Axis2FlexibleMEPClient.send(Axis2FlexibleMEPClient.java:542) at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:79)
Does anyone have experience with RabbitMQ transport, and can provide insight into potential causes?

I think the issue is in your axis2.xml configuration. Please follow the below steps.
under the transport receivers section in axis2.xml, find the rabbitmq transport receiver and replace it with your configuration. A sample configuration is given here to help you.
<transportReceiver name="rabbitmq" class="org.apache.axis2.transport.rabbitmq.RabbitMQListener">
<parameter name="AMQPConnectionFactory" locked="false">
<parameter name="rabbitmq.server.host.name" locked="false">localhost</parameter>
<parameter name="rabbitmq.server.port" locked="false">5672</parameter>
<parameter name="rabbitmq.server.user.name" locked="false">guest</parameter>
<parameter name="rabbitmq.server.password" locked="false">guest</parameter>
<parameter name="rabbitmq.connection.retry.interval" locked="false">10000</parameter>
<parameter name="rabbitmq.connection.retry.count" locked="false">5</parameter>
</parameter>
</transportReceiver>
From above configuration WSO2 ESB can act as a RabbitMQ consumer. Then locate the transport sender element in axis2.xml for the rabbitmq and uncomment it. A sample configuration for rabbitmq sender is given below.
<transportSender name="rabbitmq" class="org.apache.axis2.transport.rabbitmq.RabbitMQSender"/>
After applying this line of code, WSO2 ESB can act as a RabbitMQ producer where it can produce messages to a given RabbitMQ queue or topic.
For more on this you can find here.
http://ravindraranwala.blogspot.com/2015/09/rabbitmq-transport-in-wso2-esb.html

Related

How can WSO2 pick up messages from ActiveMQ without calling any WSO2 api or proxy by client application?

How can WSO2 pick up messages from ActiveMQ without calling any WSO2 api or proxy by client application?
[Please note:- Source System will send messages through ActiveMQ and WSO2 will have to pick up those messages]
Can anybody provide any solution?? I am clueless...
you need to:
Configure wso2 esb to work with activemq...copy /lib
directory to < ESB_HOME>/repository/components/lib
Enable and configure JMSReceiver and JMSSender for Activemq in conf/axis2/axis2.xml. uncomment the configuration for activemq.
The wso2 esb proxy need jms transport active inside it configuration.
configure this parameters after target section inside proxy configuration:
<proxy xmlns="http://ws.apache.org/ns/synapse" name="ForwardProxy" startOnLoad="true" statistics="disable" trace="disable" transports="jms1">
<target>
</target>
<parameter name="transport.jms.DestinationType">queue</parameter>
<parameter name="transport.jms.Destination">yourQueue</parameter>
<parameter name="transport.jms.ContentType">
<rules xmlns="">
<jmsProperty>contentType</jmsProperty>
<default>application/xml</default>
</rules>
</parameter>
<parametername="transport.jms.ConnectionFactory">
myQueueConnectionFactory
</parameter>
</proxy>
create yourQueue inside activeMQ.
put a message in yourQueue.

WSO2 Esb VFS through proxy

I am currently trying to set up a vfs proxy which works fine on a local ftp server. The problem is that our company internet access is blocked by a proxy so I am searching for how to specify this proxy information. As far as I know JSCH is used underneath but I haven't found a way to pass the proxy parameter.
Here is my current proxy xml:
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="ftpCollection" statistics="disable" trace="disable" transports="vfs">
<target>
<inSequence>
<clone>
<target sequence="processSeq"/>
</clone>
</inSequence>
<outSequence/>
<faultSequence/>
</target>
<parameter name="transport.vfs.ReplyFileURI">vfs:sftp://user:pw#192.168.2.99:22/reply</parameter>
<parameter name="transport.PollInterval">15</parameter>
<parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
<parameter name="transport.vfs.FileProcessInterval">100</parameter>
<parameter name="transport.vfs.FileURI">vfs:sftp://user:pw#192.168.2.99:22/process/</parameter>
<parameter name="transport.vfs.MoveAfterProcess">vfs:sftp://user:pw#192.168.2.99:22/success/</parameter>
<parameter name="transport.vfs.MoveAfterFailure">vfs:sftp://user:pw#192.168.2.99:22/failure/</parameter>
<parameter name="transport.vfs.FileNamePattern">.*.xml</parameter>
<parameter name="transport.vfs.Locking">disable</parameter>
<parameter name="transport.vfs.ContentType">application/xml</parameter>
<parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>
<parameter name="transport.vfs.MoveTimestampFormat">yyyy-MM-dd'T'HH:mm:ss.SSS</parameter>
</proxy>
Thanks
SFTP (SSH) through a proxy does work over a HTTP tunnel. You can do that with JSch described on this page.
Now already the VFS transport in WSO2 (which finally uses JSch) does not have an implementation of the HTTP tunneling. So you cannot use a simple VFS WSO2 ProxyService to do that.
You can solve it by implementing your own wso2esb transport listener. Have a look at the code of VFSTransportListener.java (or just copy/paste) and code the JSch access over http yourself. You can then add the transport in the axis2.xml configuration of your wso2esb.

SMPP using WSO2

Hi Followed the blog mentioned in SMS Transport sender in wso2 ESB and configured axis2.xml for transportSender and transportReceiver. I am able to send a message from ESB to SMPP simulator but I am unable to receive message from SMPP simulator to ESB.
In the SMPP Simulator, I tried by adding bot 't'/'r' to enable transmitter/receiver and also tried by giving tr assuming that it is for tranceiver in users.txt but still I am unable to get a response in ESB.
Could you please help in implementing SMPP -> ESB scenario. Any link that describes this procedure also helpful for me. ( I am unable to find such)
I am editing this to make my scenario more clear
My simulator is opensmpp-sim. I added the user details in user.txt as
name=esb
password=esb
timeout=unlimited
bound=t,r
I executed the simulator with port 2775.
In ESB, axis2.xml I gave the following configurations
Transport Receiver
<transportReceiver name="sms" class="org.apache.axis2.transport.sms.SMSMessageReciever">
<parameter name="systemType">cp</parameter>
<parameter name="systemId">esb</parameter>
<parameter name="password">esb</parameter>
<parameter name="host">192.168.0.2</parameter>
<parameter name="port">2775</parameter>
<parameter name="phoneNumber">94777179968</parameter>
</transportReceiver>
Transport Sender
<transportSender name="sms" class="org.apache.axis2.transport.sms.SMSSender">
<parameter name="systemType">cp</parameter>
<parameter name="systemId">esb</parameter>
<parameter name="password">esb</parameter>
<parameter name="host">127.0.0.1</parameter>
<parameter name="port">2775</parameter>
</transportSender>
Note: 192.168.0.2 = 127.0.0.1 = localhost
Scenarios
1. Sending a message from ESME (ESB) to SMSC (Simulator)
Sequence
<sequence xmlns="http://ws.apache.org/ns/synapse" name="TEST_SMS">
<send>
<endpoint key="SMSC"/>
</send>
</sequence>
Endpoint
sms://94777179968
I exposed this sequence as a REST API. When I send a message, the message reached Simulator but there is no response in return.
2. Sending a message from SMSC (Simulator) to ESMC (ESB)
From simulator when I send message, it reaches ESB. In debug mode the message is printed in ESB log. But I am unable to handle it. How can I configure proxy service/ sequence to get that message. My goal is to get that message and initiate a process.
Thanks in advance.

SOAP-request isn't dispatched by QName of the first body child element

I have a service described with this WSDL. When its operation createService is invoked with this request everything is fine. For this service a proxy service has been made on WSO2 ESB 4.6.0. Here is WSDL generated by ESB for the proxy service. When I try to send the same request to the proxy service with soapUI the following error occurs:
The endpoint reference (EPR) for the Operation not found is
/services/test.testHttpSoap11Endpoint and the WSA Action = . If this
EPR was previously reachable, please contact the server administrator.
Sending this request's body with ESB's proxy service testing tool I have no problem. I think it's because this tool uses WS-Addressing to send it. The request is also sent smoothly with soapUI if endpoint URL is appended by ?createRequest. According to this article a cause of the problem is SOAPMessageBodyBasedDispatcher. For some reason it doesn't recognize target operation by QName of the first child of the SOAP body element. But I can't understand why SOAPMessageBodyBasedDispatcher screws up in my case. Any ideas?
The main difference among WSO2 ESB 4.6.0 and earlier versions is WSO2 ESB 4.6.0 enable Passthrough Transport (PTT) by default. PTT is used to achieve very high performance boost in WSO2 ESB you can find some numbers here http://wso2.org/library/articles/2013/01/esb-performance-65.
The main problem with your use case is it expect SOAPMessageBodyBasedDispatcher to dispatch operation name. SOAPMessageBodyBasedDispatcher build the message and use first child's local name for dispatching this operation is considered as very costly and hence for the moment not supported in PPT. For the time being you can send expected SOAPAction as a HTTP header to get rid of this issue. In this thread I have provided few other solutions Error accesing published WS proxy in WSO2 ESB 4.6: EPR not found
Changing httpGetProcessor won't help here you have to change transportSender and transportReceiver configuration. You can comment out existing PTT transportSender/transportReceiver and uncomment NHTTP transportSender/transportReceiver configurations on axis2.xml file.
This is what you have on ESB 4.6.0
<transportSender name="http" class="org.apache.synapse.transport.passthru.PassThroughHttpSender">
<parameter name="non-blocking" locked="false">true</parameter>
</transportSender>
<transportReceiver name="http" class="org.apache.synapse.transport.passthru.PassThroughHttpListener">
<parameter name="port" locked="false">8280</parameter>
<parameter name="non-blocking" locked="false">true</parameter>
<parameter name="httpGetProcessor" locked="false">org.wso2.carbon.transport.nhttp.api.PassThroughNHttpGetProcessor</parameter>
</transportReceiver>
What you need is
<transportReceiver name="http" class="org.apache.synapse.transport.nhttp.HttpCoreNIOListener">
<parameter name="port" locked="false">8280</parameter>
<parameter name="non-blocking" locked="false">true</parameter>
<parameter name="httpGetProcessor" locked="false">org.wso2.carbon.transport.nhttp.api.NHttpGetProcessor</parameter>
<parameter name="disableRestServiceDispatching" locked="false">true</parameter>
</transportReceiver>
<transportSender name="http" class="org.apache.synapse.transport.nhttp.HttpCoreNIOSender">
<parameter name="non-blocking" locked="false">true</parameter>
</transportSender>

WSO2 ESB SFTP Listener not firing

i am testing some sample use cases with WSO2 where the ESB must scan an SFTP folder and perform some actions. Here is what i did:
1) I enabled the VFS transport listener in axis2.xml:
<transportReceiver name="vfs" class="org.apache.synapse.transport.vfs.VFSTransportListener"/>
<transportSender name="vfs" class="org.apache.synapse.transport.vfs.VFSTransportSender"/>
2) I inserted the following proxy (i have changed user:pass for obvious reasons) :
<proxy xmlns="http://ws.apache.org/ns/synapse" name="SFTPVFSProxy" transports="vfs" statistics="disable" trace="enable" startOnLoad="true">
<target>
<inSequence>
<log level="full" />
</inSequence>
</target>
<parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
<parameter name="transport.PollInterval">3</parameter>
<parameter name="transport.vfs.MoveAfterProcess">vfs:sftp://user:pass#10.254.241.69:22/home/user/sftp/out</parameter>
<parameter name="transport.vfs.FileURI">vfs:sftp://user:pass#10.254.241.69:22/home/user/sftp/in</parameter>
<parameter name="transport.vfs.MoveAfterFailure">vfs:sftp://user:pass#10.254.241.69:22/home/user/sftp/out</parameter>
<parameter name="transport.vfs.FileNamePattern">.*.txt</parameter>
<parameter name="transport.vfs.ContentType">text/plain</parameter>
<parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>
</proxy>
In both versions 4.5.0 & 4.5.1 nothing is triggered. No output in the log files other than some info that the proxy was successfully deployed. The exact same script works in version 3.0.1.
Furthermore, if i change "sftp" to "ftp" or to local file the listener is triggered normally in v4.X as well which makes me believe it's probably something specific to sftp handling.
Am i doing something wrong or is there a bug in the software?
Thank you in advance,
Thodoris
I think the problem is with the way you have defined the transport.vfs.FileURI property. Assuming your user's username is "user", then when you log in to sftp you go to the /home/user folder. Therefore, try defining the above property as follows.
<parameter name="transport.vfs.FileURI">vfs:sftp://user:pass#10.254.241.69:22/sftp/in</parameter>
or
<parameter name="transport.vfs.FileURI">vfs:sftp://user:pass#10.254.241.69:22/in</parameter>
I cannot say the exact config because I dont know your folder structure.
I have tried this in WSO2 ESB 4.0.3 with SFTP. My username was amilaftp. So I defined the property as follows.
<parameter name="transport.vfs.FileURI">vfs:sftp://amilaftp:password#localhost/in?vfs.passive=true</parameter>
When you try with FTP, you need to give the full path as you have done in the configuration you have provided. Thats why it is working for you with FTP in WSO2 ESB 4.X. If this works for you in 4.0.3, this should work in 4.5.x too. I suggest you to try with 4.0.3 first because it has worked for me.