Hosted target response issue

I'm using Service callout policy to call a proxy that was deployed apigee-hosted target. I'm using expressjs - resp.end({my response payload}) to send the response from the hosted target. My response payload is large and I'm seeing "..." appended to part of my response. Lets say if my response is "ABCDEFGHIJKLMNOPQR", I'm seeing the response coming in to my service callout as "ABCDEF..."(the response if same with "..." in the hosted proxy responsebody - I've traced ). Is there any size restriction on the body size of the response when dealing with hosted targets? appreciate your help

Solved Solved
0 4 268
1 ACCEPTED SOLUTION

Hi Krishna,

Thanks for sharing your proxy privately, I've managed to understand what was wrong.

When using a Service Callout with a variable, to get at the response content, you need to use the variableName.content (e.g. "validationResponse.content").

<ServiceCallout name="doValidation">
    <Request variable="validationRequest"/>
    <Response>validationResponse</Response>
    <HTTPTargetConnection>
        <URL>https://{request.header.Host}/validator</URL>
    </HTTPTargetConnection>
</ServiceCallout>

<AssignMessage enabled="true" name="validationResponse">
    <DisplayName>validationResponse</DisplayName>
    <!-- Not sure what / why "ServiceCallout.response" is .....
    <AssignVariable>
        <Name>DEBUG-SCResponse</Name>
        <Ref>ServiceCallout.response</Ref>
    </AssignVariable>
    -->
    <AssignVariable>
        <Name>DEBUG-ResponseContent</Name>
        <Ref>validationResponse.content</Ref>
    </AssignVariable>

Using "ServiceCallout.response" is not correct, I'm not sure why it even refers to anything since it's not a documented variable here: https://docs.apigee.com/api-platform/reference/policies/service-callout-policy#flowvariables

Thanks for using the community!

View solution in original post

4 REPLIES 4

When you say "i'm seeing ... appended to part of my response", where are you seeing that?

If you're seeing it in the Trace UI, this behavior is expected.

The actual payload on the network is not affected. The actual client gets the expected response.

I’m seeing ... with incomplete response payload in the Service callout response object and also the postman where Im calling the actual api.

ok, that's a novel problem. There is not a mechanism, afaik, of truncating a valid response. Apigee Edge has a maximum message size restriction, but if you exceed that you get an HTTP error, not a truncated response.

So if you can reproduce this, I'd like to see it.

Have you narrowed down any further considerations? At what size does this truncation begin? If you send a 1k message, do you get the ellipses? 2kb? 10kb? at what specific limit does it start?

Does it happen with all targets? Only with a particular target? Only with Hosted targets?

Test further, narrow it down.

Hi Krishna,

Thanks for sharing your proxy privately, I've managed to understand what was wrong.

When using a Service Callout with a variable, to get at the response content, you need to use the variableName.content (e.g. "validationResponse.content").

<ServiceCallout name="doValidation">
    <Request variable="validationRequest"/>
    <Response>validationResponse</Response>
    <HTTPTargetConnection>
        <URL>https://{request.header.Host}/validator</URL>
    </HTTPTargetConnection>
</ServiceCallout>

<AssignMessage enabled="true" name="validationResponse">
    <DisplayName>validationResponse</DisplayName>
    <!-- Not sure what / why "ServiceCallout.response" is .....
    <AssignVariable>
        <Name>DEBUG-SCResponse</Name>
        <Ref>ServiceCallout.response</Ref>
    </AssignVariable>
    -->
    <AssignVariable>
        <Name>DEBUG-ResponseContent</Name>
        <Ref>validationResponse.content</Ref>
    </AssignVariable>

Using "ServiceCallout.response" is not correct, I'm not sure why it even refers to anything since it's not a documented variable here: https://docs.apigee.com/api-platform/reference/policies/service-callout-policy#flowvariables

Thanks for using the community!