how to read http headers in esb

人盡茶涼 提交于 2019-11-28 12:45:52

You can conveniently access HTTP headers, which technically are transport headers in WSO2 ESB, by using XPath variables. The easiest way to read an HTTP header named X-EMPID is by using the following XPath: $trp:X-EMPID, where the $trp prefix indicates that the part following the colon is the name of a transport property. To log the header value you could use the following log mediator:

<log level="custom">
    <property name="X-EMPID value" expression="$trp:X-EMPID" />
</log>

To set the property myProperty to the value of X-EMPID HTTP header (which is already stored in a transport property) you would use the property mediator:

<property name="myProperty" expression="$trp:X-EMPID" />

The functionality is documented on the WSO2 site.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!