I have create an API in WSO2 ESB that receives JSON messages. I have created a messagestore to store these messages in Message Broker (guaranteed delivery pattern).
Now, the message processor that must read the queue and send the message to the backend REST api, gives the error:
TID: [0] [ESB] [2014-11-21 14:28:46,752] ERROR {org.apache.synapse.message.senders.blocking.BlockingMsgSender} - Error sending Message to url : http://lnx17.redora.local:28080/MZK-DataServices/ProcessJson/cases/newCase {org.apache.synapse.message.senders.blocking.BlockingMsgSender}
org.apache.axis2.AxisFault: Payload could not be written as JSON.
The endpoint is currently defined as an address endpoint with JSON type. I have also tried a HTTP endpoint.
In Message Broker, I cannot see the message, because it is stored as an Object (?)
Any suggestions?
Before sending it to the message store, remove the REST_URL_POSTFIX using a property mediator:
<property name="REST_URL_POSTFIX" scope="axis2" action="remove"/>
Then the message will correctly be transferred.
Related
I'm using IBM API connect & IBM DataPower 2018.
I have a SOAP web service, and I need to do some customized logging for it by capturing the request\response payload.
When the service returns a valid XML, or even SOAP exception, I could easily handle such cases, and save the request\response payload in separate DB schema for operational purposes.
I updated the response payload by returning non XML response from the backend, like "ABCDEFGHI....".
when I call this service through datapower, it returns clear response.
<errorResponse>
<httpCode>400</httpCode>
<httpMessage>Bad Request</httpMessage>
<moreInformation>Invalid XML payload received.</moreInformation>
</errorResponse>
But I am unable to capture the message.body payload which is in my case "ABCDEFGHI..", the apim.getvariable('message.body') returns nothing.
My question:
How to capture the invalid response payload (none well XML) for SOAP service by using Gateway script?
You can't... as the the message will be rejected prior to processing since DataPower will set the message type to SOAP it will reject anything not being SOAP.
You would need to pass it through a "chaining" API (or service on the DataPower instance) which could capture the response payload.
I need to callback request after output of otbound gateway . My components :
Input Message -> Service Activator ->webservice OutBound Gateway -> Response Message
here I need to check response message and supply new message as input message which depends upon response code.
Your question is not clear; you should show the configuration you have tried.
You can simply add a reply channel to the gateway and add more processing after that channel.
I have a requirement where I have to copy value of MessageID, correlationID, persistence, Expiry and Priority from request MQ message to response. I put the request message in the queue using RFHUtil . but as the message is consumed by the Session beans the messageID of MQMD header changes to some different value -HEXADECIMAL, which is different from the MessageID I put in RFHUTIL.
then I copy the above values from request to response message using set methods,- setJMSMessageID etc. but the values are different once I view the response message.
is this due to MQ to JMS conversion? what can be the solution to this.
Earlier I was using MQ Message and was able to copy all fields from request to response.
MessageID in IBM MQ is always hexadecimal, no matter from which API it is set, Base MQ or MQ JMS.
You don't need to set the MessageID while sending the request message. Let MQ do that for you. MQ will generate a unique message id for the request message. In your session beans, you simply copy the MessageID of the request message to CorrelationID of response message. This way you can correlate request and response messages.
See IBM WebSphere MQ request/reply scenario for more details.
UPDATE
Any value set using setMessageID method is ignored when the message is sent, but the method can be used to change the value in a received message.
As the message ID set by setMessageID method is ignored when a message is sent, an application cannot specify the message ID of an outgoing message. As a consequence, an application cannot receive a message and then forward the same message, or send a different message, with the same message ID as that of the message it has received. See the link:
I have to send XML message to my jms proxy service (service receive and send back message over JMS) with ESB Task (scheduler).
I tried 2 solutions.
1 solution
In added task I fill:
message -> my XML
injectTo -> set 'proxy'
proxyName -> my proxy name
The result is that, my jms proxy receive the message but without JMS_Corelation (I guess the message is send local in ESB) and I get that error:
Unexpected error sending message back
org.apache.axis2.AxisFault: Transport out has not been set
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:432)
at org.apache.synapse.core.axis2.Axis2Sender.sendBack(Axis2Sender.java:163)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:321)
at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:94)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:255)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.mediateFromContinuationStateStack(Axis2SynapseEnvironment.java:556)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:198)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:488)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:170)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.axis2.transport.local.LocalResponder.handleResponse(LocalResponder.java:214)
at org.apache.axis2.transport.local.LocalResponder.invoke(LocalResponder.java:111)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
at org.apache.synapse.core.axis2.Axis2Sender.sendBack(Axis2Sender.java:163)
at org.apache.synapse.mediators.builtin.RespondMediator.mediate(RespondMediator.java:23)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:255)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.mediateFromContinuationStateStack(Axis2SynapseEnvironment.java:556)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:198)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:488)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:170)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
If I send this message to queue, all workflow works fine, so it is well configure.
2 solution
In added task I fill:
message -> my XML
to -> my jms endpoint
format -> message format
The result is that, there is no result becasue nothing is happend. My jms proxy service doesn't receive any message.
Someone knows how to fix that?
Maybe there is another way to do that?
Your JMS Proxy is configured to receive messages from a JMS queue or topic.
You should try to write a named sequence that send an appropriate message into your queue or topic. Then, configure your scheduled task to call this sequence :
injectTo = sequence
format = soap11 (for exemple)
soapAction = mySoapAction (if needed)
message = <root>myMessage</root>
sequenceName = YourSequenceThatSendTheMessageToJMS
I am trying to send a message that the client inputs into the browser to a queue using STOMP and ActiveMQ. The STOMP connection is successful from the readouts I get in the console. I am not receiving errors and am using the line:
stompClient.send("/queue/testQSource", {}, JSON.stringify({ 'name': name }));
in my index.html to do so. However, when I check the ActiveMQ console after inputting into the browser, there is no addition to testQSource. Am I using the correct STOMP syntax to make this happen? Do I need to add any sources at the top of the HTML file other than the STOMP source?
The queue is instantiated here in the camel route:
<from uri="jms:queue:testQSource"/>
<to uri="securityBean"/>
<log message="Routing message from testQSource to testQDestination queue with data ${body}"/>
<to uri="jms:queue:testQDestination"/>
<to uri="activationBean"/>
<log message="message: ${body}"/>
EDIT
I am now getting a message through, but am receiving the following warning:
WARN : org.apache.camel.component.jms.JmsBinding - Cannot determine specific JmsMessage type to use from body class. Will use generic JmsMessage. Body class: hello.HelloMessage. If you want to send a POJO then your class might need to implement java.io.Serializable, or you can force a specific type by setting the jmsMessageType option on the JMS endpoint.
I believe this is because the STOMP message is of a different form than the queue and/or route are expecting. However, I am not sure how to configure my route in a way that will allow me to use my STOMP message. Any tips?
It's a bit tough to say without more information but my first guess is that the stomp client connection is being closed before the message gets a chance to be written to the socket or read by ActiveMQ. You might want to consider doing a blocking put to the queue by adding a request id to the out-bound frame and wait for the Broker to send you a response frame. This will ensure that your message is posted prior to the connection being closed.
How you perform the blocking put depends on the client you are using so you need to review the documentation to see what the correct means of doing so is. Usually there is either a sync send method or the client adds the 'receipt' header to the frame and then doing a blocking receive until you get back a RECEIPT frame with the correctly matching 'receipt-id' header.
Are you connecting on the stomp port on the ActiveMQ server ?
As seen in the config (activemq.xml) under "transportConnector"
stomp needs to connect on port 61613 on a default configuration.
Using Node.js with "stomp-client" and a default ActiveMQ server on localhost:
var my_client = new Stomp('127.0.0.1', 61613, 'admin', 'admin');