post client flow response header value validation and logging

Not applicable

I am getting a header variable from response, I would like to validate whether it is empty or not, if it is not empty then I would like to add it message logging policy.

Is it possible to validate response header value in post client flow?

Solved Solved
0 2 556
1 ACCEPTED SOLUTION

Not applicable

In target post flow you can certainly set a variable with the header value when it exists then use that variable in response post flow. That would look something like:

    <AssignVariable>
        <Name>log.header.foo</Name>
        <Ref>response.header.foo</Ref>
    </AssignVariable>

My preference would be to log the same way with or without the header. So a single logging policy that ignoresUnresolvedVariables is true would allow one policy to handle both conditions - defined and undefined header values.

If you do require significantly different logging behavior you can either have two message logging policies - with the one including the header conditioned by the header being populated and the second logging policy triggered when the the header is blank.

Your flow snippet would look something like:

    <PostFlow name="PostFlow">
        <Request/>
        <Response>
            <Step>
                <Name>logMessageWithFoo</Name>
                <Condition>log.header.foo != NULL</Condition>
            </Step>

            <Step>
                <Name>logMessageWithoutFoo</Name>
                <Condition>log.header.foo = NULL</Condition>
            </Step>
        </Response>
    </PostFlow>

View solution in original post

2 REPLIES 2

Not applicable

In target post flow you can certainly set a variable with the header value when it exists then use that variable in response post flow. That would look something like:

    <AssignVariable>
        <Name>log.header.foo</Name>
        <Ref>response.header.foo</Ref>
    </AssignVariable>

My preference would be to log the same way with or without the header. So a single logging policy that ignoresUnresolvedVariables is true would allow one policy to handle both conditions - defined and undefined header values.

If you do require significantly different logging behavior you can either have two message logging policies - with the one including the header conditioned by the header being populated and the second logging policy triggered when the the header is blank.

Your flow snippet would look something like:

    <PostFlow name="PostFlow">
        <Request/>
        <Response>
            <Step>
                <Name>logMessageWithFoo</Name>
                <Condition>log.header.foo != NULL</Condition>
            </Step>

            <Step>
                <Name>logMessageWithoutFoo</Name>
                <Condition>log.header.foo = NULL</Condition>
            </Step>
        </Response>
    </PostFlow>

Not applicable

Hi @kumarsathe , You should be able to enforce your message logging policy in PostClientFlow , Do you see any issues ?