xml - what is the purpose of #[message.payloadAs(java.lang.String)] in mule esb -


what purpose of #[message.payloadas(java.lang.string)] in mule esb??

can 1 explain me example. when getting response webservice mule esb. when placed simple logger #[payload] able see simple hashcode in logs @1b8353(but not payload message xml). when logged using #[message.payloadas(java.lang.string)] able see payload xml being logged clearly. can explain purpose ??

please comment further clarification!!!!

#[message.payloadas(java.lang.string)] try , transform payload given desired class. in case string.

whereas logging payload log whatever current payload representation is.

the method payloadas(class<t> outputtype) on message context class in turn calls mulemessage.getpayloadas(class<t> outputtype) believe:

http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/mulemessage.html#getpayload(java.lang.class)

will attempt obtain payload of message desired class type. try , resolve transformer can transformation. if transformer cannot found exception thrown. transformers added registry checked compatibility parameters: outputtype - desired return type returns: converted payload of message. note method not alter payload of message unless payload inputstream in case stream read , payload become read stream. throws: transformerexception - if transformer cannot found or there error during transformation of payload


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -