FW: [JDEV] Java Jabber Client
Flint Hoskins
FHoskins at jabber.com
Tue Nov 7 16:19:39 CST 2000
JabberServlets is open source and if you want to dig through the code
you can see how I registered users ...
but it looks like this is just incorrect Jabber xml
try <iq type=set id=... to=jabber.org>
and the namespace is jabber:iq:register
you don't auth until you have an id
ciao
-----Original Message-----
From: Lyndon Mark Durham
To: jabber developer
Sent: 11/7/00 11:41 AM
Subject: [JDEV] Java Jabber Client
Greetings fellow Developers,
I am attempting to write a
Jabber client using Java and the Java Xml api from the Java Project X. I
have been testing sending xml to the jabber.org server to get a feel for
the Jabber architecture. Attached is simple socket based program that I
have been using to send xml streams-nonetheless I cant get to register
sucessfully? Are there any other test Jabber servers out there? Any more
ideas- I have tried all the suggestions made so far-and I still get an
<iq type='error' id ='KLMD_86'>.
Is Jabber servers unable to create or register new accounts at present?
Has or is anyone else developed or developing a Java Client? Thanks in
advance for your assistance.
import java.net.*;
import java.io.*;
class JabberSocket {
protected static Socket sk;
protected static PrintWriter outStream;
protected static BufferedReader readIn;
public static void main(String args[]){
try{
sk = new Socket("jabber.org",5222);
outStream = new PrintWriter(sk.getOutputStream(),true);
outStream.println("<?xml version=\"1.0\"
encoding=\"UTF-8\" ?>");
outStream.println("<stream:stream to=\"jabber.org\"
xmlns=\"jabber:client\"
xmlns:stream=\"http://etherx.jabber.org/streams\">");
outStream.println("<iq type=\"set\" id=\"KLMD_86\">");
outStream.println("<query xmlns=\"jabber:iq:auth\">");
outStream.println("<username>stpeter</username>");
outStream.println("<password>dogpound</password>");
outStream.println("<resource>HomePc</resource>");
outStream.println("</query>");
outStream.println("</iq>");
System.out.println("Here");
readIn = new BufferedReader(new
InputStreamReader(sk.getInputStream()));
String data = new String();
while((data = readIn.readLine())!= null)
System.out.println(data);
readIn.close();
outStream.close();
System.out.println("Here");
}catch(IOException ioProb){ioProb.printStackTrace();}
}
}
_______________________________________________
jdev mailing list
jdev at jabber.org
http://mailman.jabber.org/listinfo/jdev
More information about the JDev
mailing list