如何在mule中设置标头用户名和密码

时间:2015-04-06 14:35:14

标签: mule

 <message-properties-transformer scope="outbound"> 
<add-message-property key="http.headers.username" value="admin" /> 
<add-message-property key="http.headers.password" value="admin"/>
<add-message-property key="Accept" value="application/json"/>
</message-properties-transformer>

    <logger message=" custom header username and password.... ... #[message.inboundProperties.'http.headers'.username]   #[message.inboundProperties.'http.headers'.password]  " level="INFO" /> 

如果我像这样在mule中设置标题用户名和密码,在日志消息中它显示空值。欢迎任何建议

1 个答案:

答案 0 :(得分:0)

使用以下内容: -

<message-properties-transformer scope="outbound"> 
<add-message-property key="username" value="admin" /> 
<add-message-property key="password" value="password"/>
<add-message-property key="Accept" value="application/json"/>
</message-properties-transformer>

并使用以下方法检索: -

 <logger  message=" custom header username and password... #[message.outboundProperties['username']] and  #[message.outboundProperties['password']]"
        level="INFO" doc:name="Logger"/>