Reputation: 42957
I am pretty new in WSO2 ESB and I have the following problem.
In my code I have a call mediator performing a request towards an external web service (represented by an endpoint), then the result obtained by this exterla web service (an XML document) is put into a mesage store.
Something like this:
<!-- Call GLIS API -->
<call>
<endpoint key="transferFromGLISAPI"/>
</call>
<log level="full"/>
<!-- Store result into transferFromResultMessageStore -->
<store messageStore="transferFromResultMessageStore"/>
It works fine, the external web service represented by the transferFromGLISAPI endpoint is correctly called and the retrieved XML document is correctly put into my message store.
My problem is that, after the call mediator execution I want retrieve also some headers value from the received response.
If I perform the call to this exterla web service using cURL infact I have something like this:
$ 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"/>
As you can see in my cURL output I also have some headers.
I want to retrieve and store into two properties the values of the X-Rate-Limit-Remaining and of the X-Rate-Limit-Reset headers. Then I want to log these value into the Carbon console.
How can I do it? How can I extract these 2 values from the obtained response and put it into properties that will be logged?
Upvotes: 0
Views: 774
Reputation: 12502
Try setting BLOCKING_SENDER_PRESERVE_REQ_HEADERS=false
just before call mediator, like this.
<property name="BLOCKING_SENDER_PRESERVE_REQ_HEADERS" value="false"/>
<call blocking="true">
<endpoint key="xxxx"/>
</call>
<log level="full"/>
Ref: https://docs.wso2.com/display/ESB490/Call+Mediator
Upvotes: 1