'xml-to-json' on Invalid XML
What will happen if "xml-to-json" policy statement is applied on an invalid XML document?
If you apply the "xml-to-json" policy statement on the request or response body that has an invalid XML document, you will not receive any errors.
What you will get is a string that looks like a corrupted XML document.
For example, client is sending the following request body with an invalid XML:
<?xml version="1.0"?> <soap:Envelope xmlns="http://fyicenter.com/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <GetOrders> <Customer>John & Sons</Customer> </GetOrders> </soap:Body> </soap:Envelope>
The "xml-to-json" policy statement will convert it to the following string:
<< ? xml version = "1.0" ? > < soap : Envelope xmlns = "http://fyicenter.com/" xmlns: soap = "http://schemas.xmlsoap.org/soap/envelope/" > < soap: Body > < GetOrders > < Customer > John & Sons < /Customer> < /GetOrders> < /soap:Body> < /soap:Envelope>
The root cause is the & sign that is not encoded as an XML entity in the request body.
2017-11-12, 1167👍, 0💬
How to use "json-to-xml" Azure API Policy Statement? The "json-to-xml" Policy Statement allows you t...
Where to find tutorials on how to create Your Own Functions in PHP? A collection of tutorials to ans...
How to Build my "sleep" Docker image from the Alpine image? I want the container to sleep for 10 hou...
How to use "link" command tool to link objet files? If you have object files previously compiled by ...
FYIcenter.com Online Tools: FYIcenter JSON Validator and Formatter FYIcenter JSON to XML Converter F...