Error "First Element must contain the local name, Envelop" when consuming JMS messages - wso2

While my listener runs it gives this error as soon as I run it. Unable to figure out what does it
2023-02-01 16:33:59,899] ERROR {JMSMessageReceiver} - Unknown error processing message org.apache.axiom.soap.SOAPProcessingException: First Element must contain the local name, Envelope , but found prov
Payload I am listening starts like below:
<prov><rowID>122</rowID><msisdn>110000171</msisdn>
Below is the settings of config in proxy service I am listening the msg from:
<parameter name="transport.jms.Destination">PROV.MAP.RT</parameter>
<parameter name="transport.jms.ContentType">text/xml</parameter>
<parameter name="transport.jms.ConnectionFactory">ProvMapperRealtimeListener</parameter>

If you are using JMS Inbound Endpoint to listen to the queue, set the following property in the Inbound EP configs.
<parameter name="transport.jms.ContentType">application/xml</parameter>
Update
In your Proxy configuration change the following property.
<parameter name="transport.jms.ContentType">application/xml</parameter>
Explanation
When a message comes into WSO2 it would be converted to a processable format based on the Content-Type of the message. For this WSO2 uses message builders, the appropriate builder is selected based on the Content-Type. By default text/plain Content-Type is built with the SOAP message builder, hence it expects a proper SOAP message body. Since you have an XML instead it fails with the aforementioned error. Once you change the Content-Type to application/xml it would be built as an XML.

Related

Getting Soap Fault on hitting a WebService using JMETER

I'm trying to contact a webservice via Jmeter (3.0), and I get the following error:
<?xml version="1.0" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
<s:Body>
<s:Fault>
<s:Code>
<s:Value>s:Sender</s:Value>
<s:Subcode>
<s:Value xmlns:a="http://schemas.microsoft.com/ws/2005/05/addressing/none">a:ActionNotSupported</s:Value>
</s:Subcode>
</s:Code>
<s:Reason>
<s:Text xml:lang="es-AR">The message with Action '' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).</s:Text>
</s:Reason>
</s:Fault>
</s:Body>
</s:Envelope>
I haven't encountered any issues contacting the web service from SoapUI, so I'm wondering what could cause this problem.
You can see the screen shots here:
The HTTP Request within the tree, first part of the HTTP Request data, the HTTP Header Manager settings: https://i.stack.imgur.com/6HxIK.jpg
Here are the results on SoapUI (works just fine):
Results and log
Is it possible that the way that SoapUI sends the requests differs from the way Jmeter does and that's why it works?
Please help. Thanks!
You need to put this action bit to be a part of the Content-Type header like:
I would also recommend adding HTTP Cookie Manager to your Test Plan
Out of interest, why don't you just record the request originated from SoapUI using JMeter HTTP(S) Test Script Recorder like:
Configure JMeter for recording. The easiest way of doing this is using JMeter Templates feature
From JMeter main menu: File - Templates - Recording - Create
Workbench - HTTP(S) Test Script Recorder - Start
Configure SoapUI for recording
From SoapUI main menu: Preferences - Proxy Settings
Proxy Settting: manual, host: IP address or hostname of machine where JMeter is running, port: 8888
Execute request in SoapUI
Inspect the recorded request in JMeter under Workbench -> Recording Controller.
I think you have some trivial error in the value of http header SOAPAction.
Happened to notice(in the image you attached) that there are double quotes in its value.
Just remove the double quotes " from the SOAPAction value.
UPDATE:
It is noticed, while editing the question, that soapui has sent an additional http header action with a value (you masked the value).
So, please add action header in the jmeter request as well the right value in the jmeter plan.

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.

Custom Uri or endpoint on WSO2

We have just installed our WSO2 ESB, and we are trying to create some proxies services with customs endpoints.
The default endoint format is:
http://{host}:{port}/services/{Proxy Service Name}
I'd like to have something like:
http://{host}:{port}/services/utilities/{Proxy Service Name}
http://{host}:{port}/services/public/{Proxy Service Name}
I followed this tutorial:
http://wso2.org/library/knowledge-base/2011/01/custom-urls-wso2-esb-proxy-services
but we have a problem, when I send a request to my custom endpoint, I have no answer.
suggestions?
I assume that you were able to properly create a custom endpoint and "I have no answer" means you didn't get any response. If it is the case following are the possible reasons for that,
Proxy service endpoint didn't receive the request
Proxy service didn't configured properly to response back
So test whether the 1 is the reason you can simply put a log mediator with following configuration in inSequence,
<log level="full"/>
then if the proxy service received a message it will log it in console. If that works could you please post your proxy service configuration to check whether it is properly defined.
Well, it seems that we've found a solution, I'm going to resume the full solution.
As the tutorial indicates, to costumize your proxy service endpoint, you have to add the following handler on the axis2.xml configuration:
<handler name="CustomURIBasedDispatcher" class="org.apache.synapse.core.axis2.CustomURIBasedDispatcher"/>
Then, you can customize your endpoint on the design view or on the source view, I've choosen the source view, adding this parameter:
<parameter name="ServiceURI">/services/intern</parameter>
The custom endpoint is autogenerated as:
http://{host}:{port}/services/intern.myWebservice
But I has not worked for me. If I send a request to the custom endpoint, I have no response.
I've solved the problem, adding to the "ServiceURI" parameter the name of the service:
<parameter name="ServiceURI">/services/intern/myWebService</parameter>
then you have to send the request to the following endpoint:
http://{host}:{port}/services/intern/myWebService
So now you have a custom endpoint for every proxy service.
Thanks Malith for your help.

WSO2 Message Broker on-demand message consumtion from WSO2 ESB

I'm trying to setup the following scenario using ESB and Message Broker.
Flow 1:
Client 1 Sends the message to ESB -> ESB consumes the message and stores it into the queue -> End of flow 1;
Flow 2:
Client 2 sends a request to ESB to get messages -> ESB gets the messages from the queue defined for Client 2 -> ESB sends back a pack of message that were present in the queue
While there's no problems to implement Flow 1. Documentation and examples refer to store and forward pattern so I didn't see any live examples on consuming message upon clients request - the "store and pull" model.
Could anyone advise please?
Reference links:
http://docs.wso2.org/wiki/display/ESB460/Sample+702%3A+Introduction+to+Message+Forwarding+Processor
http://docs.wso2.org/wiki/display/MB201/Integrating+WSO2+ESB
Best Regards,
Vladimir.
You can refer to this URL: http://wso2.org/library/articles/2013/03/configuring-wso2-esb-wso2-message-broker
I am also struck on Flow 2. I am unable to get data from mesaagebroker through my proxy
First you need to save your message in a queue
<address uri="jms:/Queue1?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.wso2.andes.jndi.PropertiesFileInitialContextFactory&java.naming.provider.url=tcp://localhost:5672&transport.jms.DestinationType=queue&java.naming.provider.url=repository/conf/jndi.properties" statistics="disable"/>
You need to specify the queue name in the repository/conf/jndi.properties as mentioned here
http://docs.wso2.org/wiki/display/MB201/Integrating+WSO2+ESB
Then you can define a proxy with the same name of the JMS queue to consume that queue
<proxy xmlns="http://ws.apache.org/ns/synapse" name="Queue1" transports="jms" startOnLoad="true" trace="disable" statistics="disable">
<target inSequence="your_in_sequence" outSequence="your_out_sequence" faultSequence="your_fault_sequence"/>
<parameter name="transport.jms.ContentType">
<rules>
<jmsProperty>contentType</jmsProperty>
<default>application/xml</default>
</rules>
</parameter>
</proxy>
You can use this proxy service to consume queue you have used to save the message
Well this is more like a custom requirement. You can achive this using a custom class mediator or a connector. [1]
[1] https://docs.wso2.com/display/ESB481/Creating+a+Connector

How to populate SOAP headers like From, ReplyTo in ESB 4.0.3

We are using WSO2 ESB 4.0.3 with Data services feature on MAC OSX 10.7.4.
I have proxy service which forwards the message to Data Service. When there is any fault in Data service the fault is returned to calling proxy service in OUTSEQUENCE. Now if there is any error I forward this to common error handler from proxy service which happens in OUTSEQUENCE. This common error handler is another proxy service only.
Now when the Error handling is completed the control returns back to original proxy service which called the error handling proxy service. But what happens is when the control returns to original proxy service from error handler it AGAIN starts executing the OUTSEQUENCE of proxy service.
So for me it is executing the OUTSEQUENCE of proxy service twice in case of fault from Data Service.
Is it standard behavior? I used to Java kind of executing where when the call from method returns it starts executing the next line. But here looks like it again starts executing the OUTSEQUENCE from beginning.
To avert executing the OUTSEQUENCE from beginning again I populate the value at "transport" scope in Error hanlder proxy which will used in filter mediator to avoid executing the logic in OUTSEQUENCE twice.
I am trying to find if there are any SOAP headers I can use instead of setting the property. I see no SOAP headers being set like "From" or "ReplyTo" and I believe message co-ordination happens with MessageId. How can we use these SOAP headers instead of property to divert the flow logic.
Please help.
thanks
Abhijit
In this case instead of using send mediator to invoke the web service you can use the call out mediator. Which makes a blocking call to error handling service and returns to the same place.
And also with esb 4.0.3 you can specify the receive sequence at the send mediator level. By default the response is received at the outsequence level.
eg. <send receive="fundTransferSequence">
<endpoint>
<address encoding="UTF-8" statistics="disable"
uri="http://10.1.23.11:8888/EgateValidWS/EgateValidWSSoapHttpPort" >
</address>
</endpoint>
</send>