views:

56

answers:

0

Problem: I have XMPP based IM application for BlackBerry. When it tries to connect to server using WAP 2.0 (no wi-fi or BIS coverage available) I'm gettings this error in the XMPP's input stream just after connect stanza is sent:

<html xmlns='http://www.w3.org/1999/xhtml'&gt;
<head><title>The request failed</title></head>
<body><p><big>The request is not understood.</big></p><p>
<i>Technical description:</i><br/></p><p>
<i>Further support:</i><br/><br/>
<a href='http://wap.epatrika.com'&gt;For further information, please see our support pages.</a></p></body>
</html>

What can be the source of the problem? No such issue when connecting via Wi-Fi or BIS.

In order to connect to the XMPP server I use the next code:

connection = (SocketConnection) Connector.open("socket://" + this.server + ":" + this.port + suffix)
connection.setSocketOption(SocketConnection.KEEPALIVE,2);

this.is = connection.openInputStream();
this.os = connection.openOutputStream();
this.reader = new StreamParser( is );
this.writer = new XmlWriter( os );

Suffix contains ID of WAP Service Record from BB service book and is built automatically depending on coverage available. And port is 5222, or when first connection attempt has failed I switch it to 80. After the connection is established the connect stanza is sent like this:

this.writer.startTag( "stream:stream" );
this.writer.attribute( "to", this._server );
this.writer.attribute( "version", "1.0" );
this.writer.attribute( "xmlns", "jabber:client" );
this.writer.attribute( "xmlns:stream", "http://etherx.jabber.org/streams" );
this.writer.flush();

Thanks