Handle 503 through fault rules

Hello,

I am hitting a taget server which is as webservice call. I am trying to handle 503 error by providing wrong target server name and see if i get intended response.

I am trying to check in fault rule condition -

	<FaultRule name="Proxy-Service-Unavailable">
	  <Condition>(error.status.code = 503)</Condition>
	  <!--Below Step will call the shared flow for setting error vars for generic faults  -->
	  <Step>
	  <Name>AM-503-Service-Unavailable-Handler</Name>
	  </Step>
	  </FaultRule>


Q1. If i use response.status.code =503 it fails the test. Why? Here it implies

https://docs.apigee.com/api-services/content/fault-handling#howerrorsoccur that response/message/error all should work fine.

I also have default fault rules below this where i try to do stuff common for all errors (including 503) setting up CORS, LOGGING etc. (always enforce = true)

I have a steps here where i convert XML to json. Since in case of 503 i want to bypass this step. I added a condition

Q2. But, this doesn't seem to work it still gets in to the excecution of XML-to-JSON-Response and fails there. Does this mean condition for steps doesn't work for default fault rules.

	<Step>
	  <condition>(response.status.code != 503)</condition>
	  <Name>XML-to-JSON-Response</Name>
	  </Step>

Please throw some light.

1 0 559
0 REPLIES 0