soap - 如何在 mule 4 的 Web 服务使用者组件中传递 Bearer Token?
问题描述
我需要以以下格式将承载令牌传递给下游系统(使用 web 服务使用者组件连接)。
Bearer [token value]
我尝试使用键传递它的内联标头:Bearer and Value= token value 但它不起作用。我试图通过下面的 XML:
%dw 2.0
output application/xml
---
headers : {
Authorization: {
"Bearer " ++ vars.licenseServerTocken
}
}
但得到以下错误:
"Error trying to acquire a new connection:Error fetching the resource [https://abc123.com/xyz/Contract.svc?wsdl]: Server returned HTTP response code: 500 for URL: https://abc123.com/xyz/Contract.svc?wsdl"
当我在正文中按以下方式传递时,它正在从 SOAP UI 工作
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tem.org/">
<soapenv:Header>
<Authorization>Bearer sada3123gjkada1231</Authorization>
</soapenv:Header>
<soapenv:Body>
请建议
解决方案
Authorization 标头不是 SOAP 请求的一部分,也不是 SOAP 标头。它是作为 SOAP 请求传输的 HTTP 请求的一部分。所以你需要在传输头部分定义。
例子:
<wsc:consume doc:name="Consume" config-ref="Web_Service_Consumer_Config" operation="MyService">
<wsc:message >
<wsc:body > ... </wsc:body>
</wsc:message>
<wsc:transport-headers >
<wsc:transport-header key="Authorization" value="#['Bearer ' ++ vars.licenseServerTocken ]" />
</wsc:transport-headers>
</wsc:consume>
推荐阅读
- python - Django 模型,处理多个外键
- c# - 为什么我安装monogame时它不显示在visual studio中?
- javascript - 加密 chrome 扩展中的文件以存储在 Firebase 存储中
- pandas - 使用 Pandas 创建具有多个旋转选项卡的电子表格
- c# - 每次导航到滑块视图时,c# xamarin 滑块设置为最小值
- python - Python BeautifulSoup 缺少我认为明显存在的标签
- sql-server - 在 SQL Server 中按 order by 求和分区
- installshield - 使用 setup.exe 在后台静默卸载
- vue.js - V-model 给出: v-on 处理程序中的错误:“TypeError:'in' 的右侧应该是一个对象,得到了 null”与计算函数
- spring-boot - 如何在 Tomcat 中的多个 Spring Boot 应用程序之间传递 Camel VM 消息