Posting XML wrapped in SOAP posted using Curl results in invalid XML character was found exceptions

2

Sending an XML file using curl results in:

Invalid XML character (Unicode : 0x<integer>)

Attempt to solve the issue

According to this SO answer the issue will be solved if the XML version is changed to 1.1.

Although the version that resides in the XML file has been updated:

<?xml version="1.1" encoding="utf-8" standalone="yes"?>

curl seems to keep sending the XML as version 1.0.

Second attempt to solve the issue

Another attempt was changing the header that is used while posting using curl as follows:

curl -X POST -H "Content-Type: text/xml; charset=utf-8; version=1.1"

Curl seems to ignore this as the output indicates that xml version 1.0 is used:

* Closing connection #0
<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope

Third attempt to solve the issue

@Ƭᴇcʜιᴇ007 advised to create a small XML file:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<soap:Envelope
    xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
    soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
    <soap:Body>
        <note>
            <to>Test</to>
        </note>
    </soap:Body>
</soap:Envelope>

validate the syntax and subsequently post it:

An invalid XML character (Unicode : 0x<integer>) was found

Fourth attempt to solve the issue

According to this answer the issue should not occur as 0x<integer_greater_than_20> is greater than 0x20.

Fifth attempt to solve the issue

What does 0x<integer_greater_than_20> represent? According to this table it represents Latin characters that seem to be acceptable.

Sixth attempt to solve the issue

Perhaps the XML file is invalid? No, according to Notepad++' Check XML syntax now option the XML is valid.

030

Posted 2015-05-06T16:20:00.817

Reputation: 1 924

0x61 is the letter "a", so it's valid in all versions so f XML. I think you may be barking up the wrong tree with XML version changes. Have you confirmed the XML isn't just invalid (bad/incomplete tag)? If you create a new XML containing as little content as needed, will it upload OK? – Ƭᴇcʜιᴇ007 – 2015-05-06T16:45:16.993

If Notepad++ is (also) telling you the XML is invalid then that's most likely your problem, your XML is invalid. Fix it so that it's valid XML and try again. – Ƭᴇcʜιᴇ007 – 2015-05-06T16:51:05.143

@Ƭᴇcʜιᴇ007 Sorry. I made a typo. Notepad++ indicates it is valid. – 030 – 2015-05-06T16:54:08.147

Sounds good. Let us know how you make out (edit the actions and results into your existing question). – Ƭᴇcʜιᴇ007 – 2015-05-06T16:58:31.003

No answers