powered by Jive Software

Anyone used XIFF for connecting to Jabber.org?

Hi Freinds,

In my chat project I’m using XIFF API and I want to connect to Jabber.org server. XIFF suports SASL PLAIN, ANONYMOUS and EXTERNAL and since I want to do non-anonymous login so I can use only SASL PLAIN and EXTERNAL. but Jabber.org does not support latter so only 1 option remains - SASL PLAIN.

My client is unable to login using SASL PLAIN and I get 401: Authentication Error from server. I have confirmed dozens of times and my username and password input is correct (I cross checked by logging in a different client using my jabber.org credentials.)

Can someone put any light on this issue?? Its making me go mad!!!

These are the logs:

client sends auth request…

Response Received from server…


sending request…


(xxxxxxxxxxxxxxx is a valid B64 encoded string of the format user@jabber.org@null�user@jabber.org�password)

Error: Ignoring policy file requested from http://jabber.org/crossdomain.xml because a cross-domain redirect to http://www.jabber.org/crossdomain.xml occurred.

Response Received from server…

401: Authentication Error

Pls guys, someone help me…



Could you attach short and simple working code which you are using while getting this behavior?

public function startConnect()


_conn = new XMPPBOSHConnection();
setupConnectionListeners(); //setup all listeners like ConnectionSuccessEvent.CONNECT_SUCCESS etc.
_conn.server = DEFAULT_SERVER_LOCATION; //sets correct location like “mydomain.com
_conn.username = un; //input from UI
_conn.password = pwd; //input from UI
_conn.resource = “myClient”;

    Security.loadPolicyFile(DEFAULT_SERVER_LOCATION + "/crossdomain.xml");


The url of HTTPRequest object (function sendRequest() in XMPPBOSHConnection) points to correct, working location of HTTP-Binding utility of the Openfire server installed on my system.

The method used in SASL PLAIN and the file used is Plain.as (lying in \org\jivesoftware\xiff\auth) and is attached herewith.

Tell me if you need more code.
Plain.as.zip (1380 Bytes)

My AUth problem got solved when I changed the format of username and password in packet to username@jabber.org/0username/0password and I started getting authentication success from Jabber.org server. But After XMPP Restart when the client sends resource binding packet I do not receive any response from Jabber.org apart from packet and after some time session times out.

Following are the logs from the client…

First request to server…

sending request…

Error: Ignoring policy file requested from http://jabber.org/crossdomain.xml because a cross-domain redirect to http://www.jabber.org/crossdomain.xml occurred.

Received from server…


sending request…

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx< /auth>

Received from server…

sending request…

Received from server…

sending request…


Received from server…

When I sniffed the network packets this was the last response before session timing out.

<?xml version='1.0'?></stream:error></stream:stream>

What do I do now? Is XIFF sending any invalid stream?

What is the last outgoing data before the diconnect?

last two packets are


I dont get any response from server and session times out.

Delving more in the logs and BOSH implementation details I can see that I’m not getting any response from Jabber.org server for XMPP restart packet.

After this i Send resource binding packet but since the stream hasn’t restarted I dont get that either.

Now what is the reason behind eJabberD 2.x version (Jabber.org) not responding to it? During my search and logs from successfully connecting client I see that XIFF is not sending the OPEN stream tag prior to XMPP restart which is

<stream:stream to=“jabber.org” xmlns=“jabber:client” xmlns:stream=“http://etherx.jabber.org/streams” version=“1.0” >

after successful Auth. When i try doing it myself then due to flash.xml.XmlNode class behavior I can only send a CLOSED stream tag

<stream:stream to=“jabber.org” xmlns=“jabber:client” xmlns:stream=“http://etherx.jabber.org/streams” version=“1.0” /> but not an Open one.

Can anyone put some light on this issue?

I think this ia a bug and it should be logged in XIFF bug databse.

While using XIFF I’m unable to connect to Jabber.org server successfully. Though the Auth successfully happens (After I tweaked Plain.as a little bit.) but server never repiles to XMPP restart packet.

Any clues/ideas? I’m stcuk with client deployment on this very issues!!!

Do you have a working solution?

Meaning can you send a restart stream by hand and get it to work, with or without the closing slash?

I am happy to apply to the trunk if you can provide the fix and possibly explain the reason and possible part of a standard explaining the correct way.

I’m still using the last beta release (instead of trunk), but to get ejabberd to work you have to remove version=“1.0” from the end of the stream type.

In the beta release, it was line 108 of XMPPSocketConnection.

Once you remove that property, ejabberd will respond. From what I’ve read, this is an issue with XIFF and not ejabberd (but I’m not positive about that).

I would assume this would cause the same issue in XMPPBoshConnection.

Looking at the trunk, it looks like the version property still gets added, but on line 509 of XMPPConnection.

We need to officially find out if this is an issue with XIFF or ejabberd.

Sounds to me a bug in Ejabberd.

Seems the specs support me: http://tools.ietf.org/html/rfc3920#section-4.4.1

It might not be so much the actual “version” part is the issue, but XIFF doesn’t handle ejabberd’s response when the “version” part is appended.

From what I remember, ejabberd does respond in some way, but XIFF didn’t seem to like it.

Here’s the server response when you leave version=“1.0” in:

<?xml version='1.0'?>DIGEST-MD5PLAIN

-------- XIFF ERROR: 400 Unexpected Request --------

And here’s when it is left out:

<?xml version='1.0'?>

-------- Successful Connection --------

From what I’m looking at, when you pass version 1.0 it seems like ejabberd is saying “sweet, you guys are using version 1.0, here’s some extra stuff you guys can use”, and XIFF probably barfs on this (possibly because its not 100% version 1.0 compliant.

Because without the Version 1.0, its a very minimal response from ejabberd that XIFF seems to be able to handle nicely.

OK… so tonight I tested connecting to my ejabberd server with the trunk classes (instead of the last beta release) and everything is successful.

It seems as if the issue I brought up has been resolved.

Mark did you use XMPPBoshConnection to connect to Jabber.org? Which http-binding have you used? Because yet I’m unable to do that.

Juga I dont have a working solution of the problem. I’m unable to solve it. I’m not getting response of XMPP Restart packet. I had taken Code of XIFF from trunk around 14th April’09 and have been using that with changes made to Plain.as for supporting Jabber.org’s authentication (After those changes only I was able to successfully connect to Jabber.org). I have already attached that file in this post earlier.
I have tried removing version=“1.0” from the packets in the past (I use XMPPBoshConnection) but That hasn’t worked. The client still fails to connect to Jabber.org.
Earlier I have mentioned in this post that perhaps by sending the OPEN <stream:stream to=“jabber.org” xmlns=“jabber:client” xmlns:stream=“http://etherx.jabber.org/streams” version=“1.0”> packet before XMPP restart I may be able to connect (On similar lines with XMPPSocketConnection). But while reading through XEP-0206 I noted that they have explicitly written that in BOSH connection that you dont need to send OPEN packets because simply they are ill-formed XML and that would not be allowed in BOSH. So that too is not needed.

I took code from trunk today and tried connecting to Jabber.org using XMPPBoshConnection. But stuck again on XMPP restart. No server response after that. while sniffing network packets I see that last packet received on Http-Binding is

<?xml version='1.0'?>

Dunno why I’m getting stream error on netwrok restart.

shubhra wrote:

Mark did you use XMPPBoshConnection to connect to Jabber.org? Which
http-binding have you used? Because yet I’m unable to do that.

I used XMPPConnection and the standard stream type.

Let me know if that works for you.

If not, I will speak with my server admin and see if he had to tweak the ejabberd server at all.

I need only BOSH connection. Cant use XMPPConnection.

Can you please talk to your server admin.



He did not apply the ejabberd patch that is floating around out there.

The biggest issue was that he had to serve up the crossdomain from the TCP port 843*.

He also had to make sure that the crossdomain was served no matter what, even on 404. When it didn’t return on 404, the connection still didn’t work. Once he did serve it up on 404, the connection was successful.

That’s all he had to do, besides me having to remove the “version” from XIFF, but that doesn’t seem necessary anymore.

We are not using BOSH, just the standard connection, so I’m not sure if that would cause any further issues.

*Adobe is applying with IANA, the Internet Assigned Numbers Authority, to reserve TCP port 843 for the purpose of serving socket policy files.

I would really appreciate if you could help me with BOSH connection issue coz I cant use socket connection in my app. I’ll discuss your suggestions on monday when i join back but any help on my issues wil BOSH connection will be a great help :slight_smile: