'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, 310👍, 0💬
How to start Visual Studio Command Prompt? I have Visual Studio 2017 Community version with Visual C...
How To Create Table Borders? There are two sets of borders within a table: Outer Borders - Borders t...
How To Support Multiple-Page Forms in PHP? If you have a long form with a lots of fields, you may wa...
FYIcenter.com Online Tools: FYIcenter JSON Validator and Formatter FYIcenter JSON to XML Converter F...
How To Return a Reference from a Function? in PHP? To return a reference from a function, you need t...