Reputation: 823
Hello I am trying to log the content of the POST content in Mule ESB as the other end receives all content except the the ContactId which is in binary. We are trying to identify where the error is. Here is the flow.
<flow name="ContactUpdate">
<http:inbound-endpoint exchange-pattern="request-response" host="host" port="port" path="ContactUpdate" doc:name="HTTP"/>
<logger level="INFO" doc:name="Logger" message="#[payload]"/>
<ws:consumer config-ref="Web_Service_Consumer" operation="UpdateContact" doc:name="UpdateContact"/>
</flow>
In the log I can only see the content's lenght and other informations but not the actual content of the body that is sent in POST. Is it possible to do such a thing?
Thanks for helping
Upvotes: 1
Views: 4116
Reputation: 30
We can retrieve the message payload in a particular format, using Mule’s auto-transformation capability, use payloadAs:
<logger message="#[message.payloadAs(java.lang.String)]" />
your code can be changed as
<flow name="ContactUpdate">
<http:inbound-endpoint exchange-pattern="request-response" host="host" port="port" path="ContactUpdate" doc:name="HTTP"/>
<logger level="INFO" message="#[message.payloadAs(java.lang.String)]"/>
<ws:consumer config-ref="Web_Service_Consumer" operation="UpdateContact" doc:name="UpdateContact"/>
</flow>
Upvotes: 0
Reputation: 1
Upvotes: 0
Reputation: 33413
As explained in the documentation, you can retrieve the payload as a String in a MEL expression:
<logger level="INFO" message="#[message.payloadAs(java.lang.String)]"/>
Keep in mind this will deserialize the HTTP request input stream payload, which could hit your memory badly if you're receiving a huge payload.
Upvotes: 5