Skip to content
This repository has been archived by the owner on Jan 10, 2022. It is now read-only.

XML parsing error: "Not well-formed (invalid token)" at Line 1 at column 1 #33

Closed
Raviideal01 opened this issue Apr 12, 2016 · 2 comments

Comments

@Raviideal01
Copy link

I am getting error " XML parsing error: "Not well-formed (invalid token)" at Line 1 at column 1"

@DMeganoski
Copy link

DMeganoski commented May 11, 2016

Just the exception without any more information isn't enough to help you. There are hundreds of reasons you could get this error, starting with your server sending non-xml as a response.

I am also getting this error when connecting to a local openfire server, but it seems to be because openfire is returning a hex-looking string at some point, and the parsing fails. This is likely more of an openfire issue, but I can't seem to find any help on this topic, so I'm turning here in hopes that someone may have some clue as to what's going on.

Here is the string it fails to parse:

"\x15\x03\x01\x00\x02\x02P"

Edit: I thought I was getting more than one response, but the first was my request going through the parser.

What is going on here? Why is it returning hexidecimals instead of xml? Does this have something to do with SSL?

@Irker
Copy link

Irker commented May 19, 2016

@DMeganoski seems it looks like problem with ssl connection.
For example in my situation:
I tried to connect to host by local hostname, but my openfire has normal hostname and configured to use it, and has certificate for it.

I fixed my problem to provide context options to socket:

$context_options = [
                'ssl' => [
                    'peer_name'         => 'example.com',
                ],
            ];

So if I use local hostname in $address, socket will check sertificate for 'example.com'.

But it's not all. Next broken autorization, because xmpp use host from $address. But in 'Options' object we also can fix it bu call $Options->setTo() method.

I don't know your case, but may be you has wrong certificate or something also. You can try to switch off sertificate checking: ['ssl' => ['verify_peer' => false,'verify_peer_name' => false]]

Or allow self-signed sertificate: ['ssl' => [allow_self_signed' => true]]
Or both.

To do it you can use stream_context_set_default method or vote for #31 pull request to add context options in xmpp project.

@fabiang fabiang closed this as completed May 23, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants