0

I have the following file that I cURL:

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soap:Body>
      <ProcessMessage xmlns="http://www.user.com/test/">
        <envelope>Encoded XML request message will go here</envelope>
      </ProcessMessage>
   </soap:Body>
</soap:Envelope>

The full error I get is this:

org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.

When I use the file with a CDATA element then everything works as expected.

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soap:Body>
      <ProcessMessage xmlns="http://www.user.com/test/">
         <![CDATA[<?xml version="1.0" encoding="UTF-8"?>
           <envelope>Encoded XML request message will go here</envelope>
         ]]>
      </ProcessMessage>
   </soap:Body>
</soap:Envelope>

Any idea how I can accept an XML file without the CDATA part?

A.J
  • 1,140
  • 5
  • 23
  • 58

1 Answers1

0

quote: "Only one XML declaration is permitted in well-formed XML, and it must be at the top if anywhere."

See: https://stackoverflow.com/a/20251895/3710053

So if you could get rid of that second <?xml version="1.0" encoding="UTF-8"?> your okay.

Siebe Jongebloed
  • 3,906
  • 2
  • 14
  • 19