Hi
I have a Service Call Out which return Http Status Code.
I want to capture this http status code in Extract Variables Policy so that I can use it as a Condition for raising the fault
Here is the Extract Variables Policy which I am using
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> ParseTokenInfoResponse true
calloutResponse tokenInfo calloutResponse.status.code
And for raising the fault
Raise-Fault NOT(tokenInfo.status_code == 200)
Please let me know what is missing here
Thanks
1 Like
Hi @arghya das
It is printing the status code in javascript
print("Status Code Variable >> "+context.getVariable(“calloutResponse.status.code”));
results in Status Code Variable >> 200
So is it not working after assigning it to a variable ?
The NOT condition doesn’t look right. Can you try != or NotEquals
Hi @Abhishek Subramanya
It’s not working when I am using custom variable.
Hi @GAURAV ,
The ExtractVariable policy is used to extract values within a pattern. In your case, use please use AssignMessage policy to reassign the value calloutResponse.status.code into custom variable status_code -
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AssignMessage async="false" continueOnError="false" enabled="true" name="Assign-Message-1">
<DisplayName>Assign Message 1</DisplayName>
<Properties/>
<AssignVariable>
<Name>status_code</Name>
<Ref>calloutResponse.status.code</Ref>
</AssignVariable>
<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
</AssignMessage>
Thanks,
Abhishek