A quick solution is set continueOnError to true on Service Callout & use RaiseFault / Assign Message policy with a policy condition that verifies service callout response.
Hope it helps.
A quick solution is set continueOnError to true on Service Callout & use RaiseFault / Assign Message policy with a policy condition that verifies service callout response.
Hope it helps.
Hi @Prathip,
You can capture the error by setting the property success.codes under HTTPTargetConnection in the service callout policy as below:
<HTTPTargetConnection>
<Properties>
<Property name="success.codes">2xx,4xx,5xx</Property>
</Properties>
<URL>https://www.mock.com</URL>
</HTTPTargetConnection>
Thanks for the answer. But this is same as continueOnError=“true”. The problem I am facing is, after this error is thrown the response gives a 500 error and none of my policies to create a custom error messages are executed…
Issue is solved. I had used the servicecallout.{policy-name}.failed variable as condition to raise the fault and get my desired fault message and fault error code. Thanks.
Hi @Prathip,
Please add the snapshot of how have you implemented. I am also having similar issue. Also add details about raising the fault (policy & configuration)
Once an error is raised in the service callout flow the below variable gets populated.
servicecallout.GetAccessTokenForUser.failed to true.
I had used the below in Proxy flow to raised a custom fault when the above condtion gets hit.
RaiseInvalidUsernamePasswordFault
servicecallout.GetAccessTokenForUser.failed=true
You can have your customer error messages in the RaiseInvalidUsernamePasswordFault rule. Hope it helps.