ServiceCallout - Ignore errors

We are using a ServiceCallout for logging purposes and have excluded the <Response> tag in the policy definition as, from what we understand, that will cause the policy to not wait for a response thus becoming a fire-and-forget scenario. This works well if the logging endpoint is up but if the endpoint the ServiceCallout policy is calling is down, a call to the Apigee endpoint that invokes the ServiceCallout policy returns with the following:

{
    "fault": {
        "faultstring": "Execution of ServiceCallout Logging failed. Reason: timeout occurred in Logging",
        "detail": {
            "errorcode": "steps.servicecallout.ExecutionFailed"
        }
    }
}

Is there a way to make it so that regardless of what happens in the ServiceCallout that the actual response to the user isn't interrupted?

The current configuration of the ServiceCallout:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ServiceCallout async="false" continueOnError="false" enabled="true" name="Logging">
    <DisplayName>Logging</DisplayName>
    <Properties/>
    <Request clearPayload="true" variable="myRequest">
        <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
        <Set>
            <Headers>
                <Header name="Authorization">AUTH_TOKEN_HERE</Header>
            </Headers>
            <Payload contentType="application/json">
                {
                    ... Various properties ....
                }
            </Payload>
            <Verb>POST</Verb>
        </Set>
    </Request>
    <HTTPTargetConnection>
        <Properties/>
        <URL>https://logging.logging.com/PostXXX</URL>
    </HTTPTargetConnection>
</ServiceCallout>
Solved Solved
0 1 391
1 ACCEPTED SOLUTION

If you are looking to ignore the errors from the policy you can set continueOnError="true" in the root element, it forces the policy to ignore any errors and continue execution.

View solution in original post

1 REPLY 1

If you are looking to ignore the errors from the policy you can set continueOnError="true" in the root element, it forces the policy to ignore any errors and continue execution.