ServicecalloutResponse empty

I am calling an internal proxy through serviceCallout . In that proxy we have quota limits policy.

But the ServiceCallout Response is empty. I want to extract the parameters like ratelimit.Quota-Day.available.count out of that internal proxy to the calling proxy.

Below is the flow:

Proxy-->ServiceCallout-->InternalProxy(Having Quota Limit policies)-->ServiceCallout response empty

I need to extract the quota limits out of that internal proxy.

0 1 133
1 REPLY 1

You have two problems.

First, your servicecallout response is empty. You haven't provided any trace data, nor have you showed any policy configuration. Therefore I guess you're going to work this problem out, yourself.

Second, you want the inner proxy to communicate back to the caller the quota available count. As you may know, after the Quota policy executes, it sets context variables indicating the available count remaining, and the oroiginal allowed count, among other items. (Consult the documentation for more details). To get that information to the caller, you need to use the HTTP Response. The way I recommend doing it is to inject Response headers. For example, add this to the inner proxy:

<AssignMessage name='AM-AddQuotaHeaders'>
  <Set>
    <Headers>
      <Header name='X-quota-remaining'>{ratelimit.Quota-1.available.count}</Header>
      <Header name='X-quota-allowed'>{ratelimit.Quota-1.allowed.count}</Header>
    </Headers>
  </Set>
</AssignMessage>
  

That needs to be attached so that it executes after the Quota policy executes. Change the names of the variables to match the name of your Quota policy.