Skip to content

looks like we got no XML document - nice message, but why is it so? 馃 #505

Answered by veewee
trailsnail asked this question in Q&A
Discussion options

You must be logged in to vote

Hello,

The exception is coming from PHP's SoapClient and means it is unable to parse the provided XML response.

 is an invalid character in XML. The best way to overcome this error is to add a HTTP plugin/Middleware that makes sure the XML is parsable by for example cleaning up this and any other unsupported character you encounter before they get decoded by the SoapClient.

https://3v4l.org/PkH7j

$doc = new DOMDocument();
$doc->loadXML('<test>wor&#x2;ld</test>');

echo($doc->documentElement->nodeValue);

Warning: DOMDocument::loadXML(): xmlParseCharRef: invalid xmlChar value 2 in Entity,

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@trailsnail
Comment options

@trailsnail
Comment options

@veewee
Comment options

Answer selected by trailsnail
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants