我在WSO2 EI上配置了一个WSDL代理服务,它指向OAuth保护的外部服务。
我的问题是,除了我所有的努力,我无法在我的服务电话上设置Bearer Authorization标头。服务端点始终返回“无法找到oauth令牌”错误。我已经尝试了所有关于标题的WSO2教程和文档(使用Header Mediator和标题作为属性),但没有任何作用。
我的问题类似于this one,也没有回答。
WSDL代理服务由WCF .NET应用程序使用,并且已设置Bearer标头。
这是XML配置:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="WSDLProxy"
startOnLoad="true"
statistics="disable"
trace="disable"
transports="http">
<target>
<inSequence>
<send>
<endpoint>
<wsdl port="RegisterEndpoint"
service="RegisterService.serviceagent"
uri="[external-wsdl-uri]"/>
</endpoint>
</send>
</inSequence>
<outSequence>
<send/>
</outSequence>
</target>
<publishWSDL uri="[external-wsdl-uri]"/>
</proxy>
在直通方案中,例如WSDL代理服务的给定样本,如果在客户端的'WSDLProxy'请求中发送了'Authorization'标头,它将被发送到后端服务。但是,如果您的客户端在自定义传输标头中发送了承载令牌,则必须在后端调用之前将其设置为“授权”标头,如下所示。
...
<inSequence>
<property expression="get-property('transport', 'CUSTOM-Bearer')" name="Authorization" scope="transport" type="STRING"/>
<property action="remove" name="CUSTOM-Bearer" scope="transport"/>
<send>
<endpoint>
<wsdl port="RegisterEndpoint"
service="RegisterService.serviceagent"
uri="[external-wsdl-uri]"/>
</endpoint>
</send>
</inSequence>
...