如何在WSO2 ESB中正确获取response headers的值(调用mediator后获取的response)

How can I correctly obtain the value of response headers in WSO2 ESB (the response obtained after a call mediator)

我是 WSO2 ESB 的新手,我遇到了以下问题。

在我的代码中,我有一个 调用调解器 执行对外部 Web 服务(由端点表示)的请求,然后此外部 Web 服务获得的结果(XML 文档) 被放入 消息存储区 .

像这样:

<!-- Call GLIS API -->
<call>
    <endpoint key="transferFromGLISAPI"/>
</call>
<log level="full"/>

<!-- Store result into transferFromResultMessageStore  -->
<store messageStore="transferFromResultMessageStore"/>

工作正常,由 transferFromGLISAPI 端点表示的外部 Web 服务被正确调用,检索到的 XML 文档被正确放入我的消息存储中。

我的问题是,在 调用调解器 执行之后,我还想从收到的响应中检索一些 headers 值。

如果我使用 cURL 执行对此 exterla 网络服务的调用,事实上我有这样的东西:

$ curl -i -k https://XXX.YYY.ZZZ.WWW/glisapi/v1/pgrfas?doi=10.0155/1M
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   103  100   103    0     0    164      0 --:--:-- --:--:-- --:--:--   164HTTP/1.1 200 OK
Date: Tue, 11 Jul 2017 07:51:08 GMT
Server: Apache/2.4.7 (Ubuntu)
X-Rate-Limit-Limit: 3
X-Rate-Limit-Remaining: 2
X-Rate-Limit-Reset: 0
X-Pagination-Total-Count: 0
X-Pagination-Page-Count: 0
X-Pagination-Current-Page: 1
X-Pagination-Per-Page: 10
Link: <https://XXX.YYY.ZZZ.WWW/glisapi/v1/pgrfas?doi=10.0155%2F1M&page=1&per-page=10>; rel=self
Vary: Accept-Encoding
Content-Length: 103
Content-Type: application/xml; charset=UTF-8

<?xml version="1.0" encoding="UTF-8"?>
<pgrfas xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>

如您在我的 cURL 输出中所见,我也有一些 headers。

我想检索 X-Rate-Limit-RemainingX-Rate-Limit-Reset[=39= 的值并将其存储到两个属性中] headers。然后我想将这些值记录到 Carbon 控制台中。

我该怎么做?如何从获得的响应中提取这 2 个值并将其放入将记录的属性中?

尝试在调用调解器之前设置 BLOCKING_SENDER_PRESERVE_REQ_HEADERS=false,像这样。

<property name="BLOCKING_SENDER_PRESERVE_REQ_HEADERS" value="false"/>
<call blocking="true">
    <endpoint key="xxxx"/>
</call>
<log level="full"/>

参考:https://docs.wso2.com/display/ESB490/Call+Mediator