Below is my policy example, please let me why no fault has been raised if referenced xpath is invalid.
<ExtractVariables name="Extract-Variable-Submit-Request">
<IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
<URIPath>
<PatternignoreCase="true">/sendEmail/{BusinessProcessId}</Pattern>
</URIPath>
<XMLPayload stopPayloadProcessing="false">
<Namespaces/>
<Variablename="Item" type="nodeset">
<XPath>/Data/Item</XPath>
</Variable>
</XMLPayload>
<Source clearPayload="true">request</Source>
</ExtractVariables>
When no XPath is satisfied within the ExtractVariables policy , the policy does not cause a fault.
The way to handle this case is with a condition in the flow, after the policy, testing the extracted variable.
...
<Step>
<Name>Extract-Variable-Submit-Request</Name>
</Step>
<Step>
<Condition>Item = null</Condition>
<Name>RaiseFault-InvalidXml</Name>
</Step>
...
Thank you Dino…
Extract policy causing the fault with json payload which i am using in another proxy ( expected
behaviour ) policy xml as below. The same behaviour i expected in XML payload as well.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ExtractVariables async="false" continueOnError="false" enabled="true" name="Extract-Inputs">
<DisplayName>Extract Input Data</DisplayName>
<Properties/>
<IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
<JSONPayload>
<Variable name="AddressLine1">
<JSONPath>$.AddressLine1</JSONPath>
</Variable>
<Variable name="AddressLine2">
<JSONPath>$.AddressLine2</JSONPath>
</Variable>
<Variable name="City">
<JSONPath>$.City</JSONPath>
</Variable>
<Variable name="State">
<JSONPath>$.State</JSONPath>
</Variable>
<Variable name="Zip5">
<JSONPath>$.Zip5</JSONPath>
</Variable>
</JSONPayload>
<Source clearPayload="false">request</Source>
</ExtractVariables>
Fault Response
{
"errorResponse": {
"code": "500",
"message": "Invalid JSON path $.City in policy Extract-Inputs.",
"info": "/gkcv-bosdp-ecpdid/v1/openapi.json",
"x-bos-api-tx-id": "12:19_3:45-fldldfetvw004-8338-1122350-1_recorded"
}
}