Mule http connector seems to "eat" variable

202 Views Asked by At

I have a question for you as I have't been able to resolve this myself. I have been developing a mule application that activates when a message gets posted to active mq topic. When using mule locally everything works fine, even when these messages are posted to ActiveMq topic by another system. I uploaded my mule application to server and in the server it only works when I post messages manually. I am forced to use mule 3.5.1 EE.

My flow simplified: variable is read from message and then that variable is used in HTTP connector which returns XML.

Here are my logs from the server:

Here is how it works when called by hand (and how it work in both cases when using local mule):

org.mule.api.processor.LoggerMessageProcessor: 13173178 <- this is the variable
org.mule.api.processor.LoggerMessageProcessor: correct xml file

This is how it works with call from another system:

org.mule.api.processor.LoggerMessageProcessor: 13173178 <- this is the variable that gets lost
org.mule.transport.service.DefaultTransportServiceDescriptor: Loading default outbound transformer: org.mule.transport.http.transformers.ObjectToHttpClientMethodRequest
org.mule.transport.service.DefaultTransportServiceDescriptor: Loading default response transformer: org.mule.transport.http.transformers.MuleMessageToHttpResponse
org.mule.transport.service.DefaultTransportServiceDescriptor: Loading default outbound transformer: org.mule.transport.http.transformers.ObjectToHttpClientMethodRequest
org.mule.lifecycle.AbstractLifecycleManager: Initialising: 'connector.http.mule.default.dispatcher.1289595614'. Object is: HttpClientMessageDispatcher
org.mule.lifecycle.AbstractLifecycleManager: Starting: 'connector.http.mule.default.dispatcher.1289595614'. Object is: HttpClientMessageDispatcher
org.mule.api.processor.LoggerMessageProcessor: empty xml file <- empty XML is returned when http gets called without flow variable

Any help is greatly appreciated!

Edit:

Snippet from my code

<jms:inbound-endpoint queue="myQueue" connector-ref="Active_MQ" doc:name="JMS"/>

    <set-variable variableName="myvariable" value="#[xpath('string(//myvariableId)')]" doc:name="Set myvariable"/>
    <logger message="#[flowVars.myvariable]" level="INFO" doc:name="Logger"/>
    <http:outbound-endpoint exchange-pattern="request-response" host="localhost" port="20007" path="mypath.OrderNumber='AD-#[flowVars.myvariable]'" method="GET" doc:name="Get XML" disableTransportTransformer="true"/>
    <mulexml:dom-to-xml-transformer doc:name="DOM to XML"/>
    <logger message="#[payload]" level="INFO" doc:name="Logger"/>
2

There are 2 best solutions below

9
JoostD On

What are you trying to do in the HTTP connector with path??

path="mypath.OrderNumber='AD-#[flowVars.myvariable]'"

your path should be a valid path something like "/mypath/test" i don't get the point of the variable being eaten?! you need to drop some more info to help you out.

1
Qant On

The problem was not in mules HTTP connector, but in the another system. The another system was too slow to process its data and my mule app running in the server was too fast. It only seemed that it was losing the variable but the reason for the false response was that it didn't have the correct response ready. Corrected the problem with a timer.