Hello,
I used Service Callout policy to call the service. whenever the server is down of that particular
service Then I have to show the response that is coming from the backend in the console.
Could any one please help me?
Hello,
I used Service Callout policy to call the service. whenever the server is down of that particular
service Then I have to show the response that is coming from the backend in the console.
Could any one please help me?
Welcome to the community !!!
Not sure I understand the issue. Can you detail a bit more ?
What I understood is - you are making a Service callout and if that system is down, you want to send the request to another target system ? Is that correct ? Not sure what you mean by “show the response that is coming from the backend in the console”
You could return a previously cached version of the response if the risk of stale data isn’t high for your use case?
@NAVAJEEVANA BATHULA, As per my understanding you want to display the back end error message as-is on the front end. Follow the below mentioned steps to achieve it.
<FaultRule name="ExecutionFailed">
<Step>
<Name>AM-Set-Execution-Failed-Error</Name>
</Step>
<Condition>(fault.name == "ExecutionFailed") or (fault.name == "servicecallout.ExecutionFailed")</Condition>
</FaultRule>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AssignMessage name="AM-Set-Execution-Failed-Error" enabled="true" continueOnError="false" async="false">
<DisplayName>AM-Set-Execution-Failed-Error</DisplayName>
<Set>
<Headers/>
<Payload contentType="application/json">{ServiceCallout.response}</Payload>
<StatusCode>{response.status.code}</StatusCode>
</Set>
<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
<AssignTo type="request" transport="http" createNew="false"/>
</AssignMessage>
Thanks for your response Mahammad Feroz. when the server is up I am getting response for ServiceCallout.response but if the server is down ServiceCallout.response is showing null. it is not returning any value. Is there anyting we could with this.
, use “error.content” instead of “ServiceCallout.response” in the AssignMessage (AM-Set-Execution-Failed-Error) policy.