我一直在努力访问在流程中定义的变量,现在我需要将它用作 HTTP 请求组件中授权标头的一部分。到目前为止,我已经尝试了以下方法:
"Bearer " ++ vars.myVar
"Bearer " ++ #[vars.myVar]
"Bearer #[vars.myVar]"
它们都不起作用,因为我能够在控制台日志中看到原始输入,内容如下:
POST /webserviceurl HTTP/1.1
accept: application/json
authorization: "Bearer " ++ #[vars.myVar]
x-correlation-id: 06386edf-93a9-4d38-a117-d971f9eb7c11
Host: test.salesforce.com:443
User-Agent: AHC/1.0
Connection: keep-alive
Content-Type: application/json
这是 HTTP 请求配置的定义:
<http:request-config name="HTTP_Request_configuration" doc:name="HTTP Request configuration" doc:id="ad136a30-3119-44d1-ac13-8163214df28b" >
<http:request-connection protocol="HTTPS" host="${SalesforceBaseUrl}" port="443" >
</http:request-connection>
<http:default-headers >
<http:default-header key="content-type" value="application/json" />
<http:default-header key="accept" value="application/json" />
<http:default-header key="Authorization" value='"Bearer " ++ #[vars.myVar]' />
</http:default-headers>
</http:request-config>
我在这里缺少什么?哪一种是在那里访问变量的正确方法?