Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Logging the original request in the PostClientFlow Response flow when using a target endpoint

Not applicable

I would like to log the original request that was submitted as well as the response sent back using the OOB logging policy as one log policy step within the Proxy Endpoint PostClientFlow Response flow. As part of the processing within my API, I have a target endpoint that I invoke to retrieve some data. As soon as the target endpoint flow starts, the original request is replaced with the request to the target endpoint (i.e. the values in the request.content variable) and I am unable to locate a variable that contains the original request. I tried using an Assign Message Policy on the Proxy Endpoint Request flow to keep the original request but it doesn't seem to be available from the PostClientFlow Response flow. Is there a way to log both the original request and outgoing response in the PostClientFlow Response flow as one logging policy or do I need to log the original request prior to invoking the target endpoint Request flow and then log the outgoing response on the PostClientFlow Response flow?

Solved Solved
0 5 2,226
1 ACCEPTED SOLUTION

Not applicable

Here is what finally provided what I was looking for. I forgot to mention in the original question that I was also looking for the header values. This post was helpful as it indicated to use the Set construct instead of Copy to include the content (for some reason, using <Payload>true</Payload> didn't work for me:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AssignMessage async="false" continueOnError="false" enabled="true" name="amp_setOriginalRequest">
    <AssignTo createNew="true" transport="http" type="request">varOriginalRequest</AssignTo>
    <DisplayName>amp_setOriginalRequest</DisplayName>
    <FaultRules/>
    <Properties/>
    <Set>
        <Payload>{request.content}</Payload>
    </Set>
    <Copy>
        <Headers/>
    </Copy>
    <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
</AssignMessage>

View solution in original post

5 REPLIES 5