Extract variable placed in fault rule. what is the source- response or anything else?

Not applicable

Hello All,

My target server is giving response as

{ "fault": { "faultstring": "The Service is temporarily unavailable", "detail": { "errorcode": "messaging.adaptors.http.flow.ServiceUnavailable" } } }

so error = The Service is temporarily unavailable

because of this APIGEE is giving 503 service unavailable. So by placing response.status.code=503 either in faultrule or allowing success.code = 5xx is not giving any results. They are not getting executed.

So i thought of placing extract variable in default fault rule and want to capture the jsonpayload information. based on the extracted variable information, i would like to raise a fault.

However in extract variable policy what should be the "source" value. because when i gave source=response it 's not getting executed policy failing with below error.

error response message is not available for ExtractVariable: jsonpayloadextract

Regards,

ch. Venkat.

0 5 687
5 REPLIES 5

Not applicable

Hello All,

Found the solution. I have replaced the source=error instead of source=response. I'm able to extract the payload info from error flow.

if any one has any other alternative from above approach. Please post here.

Regards,

Ch. Venkat.

@venkat ch: Nice Post.

But I was not able to access status code. Did you find a way to access the status code in case of error flow in Extract Variable Policy?

I did not find any variable error.status.code as we have in case of response object i.e. response.status.code.

Not applicable

Hello Vipul,

If the target server is sending the response codes then we can use response.status.code even in error flow. i don't think we have something called error.status.code.

In my case in extract variable policy, since source "response" was not working i kept source=error.

But i'm not sure whether error.status.code would work.

Regards,

Ch.Venkat

I have tried that. I was not able to access the same so treated 4XX & 5XX as success code and then extracted as shown below.

<HTTPTargetConnection>
        <Properties>
            <Property name="success.codes">1xx,2xx,3xx,401,403</Property>
        </Properties>
        <URL>https://XXXXXXX/XXXXXXX</URL>
    </HTTPTargetConnection>

Is there any other way to extract status code in case of error??

@Anil Sagar can you please help?

Not applicable

hi Vipul,

Please check this

503 error

To handle this case i have used extract variable policy and extracted the payload response and had put the condition to compare the payload response extracted string.

Regards,

Ch.Venkat.