[英]Set X-Auth-Token header in http connection endpoint in WSO2 ESB
I'm new in WSO2 esb and for beginning i want to make a http connection to my external REST API. 我是WSO2 esb的新手,一开始我想与我的外部REST API建立http连接。 This API is authenticated with X-Auth-Token header and its value.
该API已通过X-Auth-Token标头及其值进行了身份验证。 I have tried to set this with header mediators but i don't know how do it.
我试图用头中介来设置它,但是我不知道该怎么做。 If i set Header name: X-Auth-Token and value literal: w2441sdcxvcp2 I obtain below exception when deploy:
如果我设置标头名称:X-Auth-Token和值文字:w2441sdcxvcp2部署时,我得到以下异常:
Invalid SOAP header: X-Auth-Token specified at the header mediator.
无效的SOAP头:在头中介器上指定的X-Auth-Token。 All SOAP headers must be namespace qualified.
所有SOAP标头都必须是名称空间限定的。
Has someone any idea or suggestion? 有任何想法或建议吗? Thanks
谢谢
This is the code of my proxy: 这是我的代理的代码:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="Proxy" transports="http https" startOnLoad="true" trace="disable">
<target>
<inSequence>
<header name="X-Auth-Token" scope="default" value="9a417d9d-712f-4eaf-ad38-7352394cea62"/>
<log level="full"/>
<send>
<endpoint key="TokenSMS"/>
</send>
</inSequence>
<outSequence>
<log level="full"/>
</outSequence>
<faultSequence/>
</target>
</proxy>
Now I no longer have the error but when send mediators call the API the authentication fails (how when no header has setted). 现在,我不再遇到错误,但是当发送介体调用API时,身份验证将失败(如何在未设置标头的情况下)。
如果您想观察发生了什么:在代理上启用跟踪:并在以下位置检查跟踪日志:esb_home \\ repository \\ logs \\ wso2-esb-trace.log
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.