[jdev] Gateway connection denied

Cedric Hyppolite cedric.hyppolite at free.fr
Wed Apr 26 16:25:58 CDT 2006


Hi,

I am trying to connect a gateway using code copied from this testcase:

http://www.jivesoftware.org/fisheye/viewrep/~raw,r=2739/svn-org/ 
transports/trunk/test/org/jivesoftware/messenger/gateway/test/ 
JEP_100.java

I am connected to im.apinc.org and tried using aim and msn gateways.  
The login/pass for both are working fine using PSI client.

But I get an error at the last line of the following code so I guess  
that the registration is failing. Am I doing things in the wrong  
order or is it a server problem ?

Thanks,
Cedric HYPPOLITE



... DiscoverInfo info set after service discovery  ...

if (! info.containsFeature("jabber:iq:register")) {
			throw new Exception("Gateway does not support registering");
		}
		
		PacketCollector collector = conn.createPacketCollector(new  
PacketFilter() {
			public boolean accept(Packet arg0) {
				return arg0 instanceof Registration;
			}});
		
		// 4.1.1.3 Jabber User sends IQ get qualified by the In-Band  
Registration
		Registration conv1 = new Registration();
		conv1.setType(IQ.Type.GET);
		conv1.setTo(gatewayName);
		conn.sendPacket(conv1);
		
		// 4.1.1.4 Gateway returns IQ result to Jabber User, specifying  
information that
		//  is required in order to register
		Registration response = (Registration)collector.nextResult();
		
		// 4.1.1.5 Jabber User sends IQ set qualified by the  
'jabber:iq:register' namespace
		//  to Gateway
		Registration regRegister = new Registration();
		regRegister.setType(IQ.Type.SET);
		regRegister.setTo(response.getFrom());

		DataForm df = new DataForm("submit");
		FormField pwdField = new FormField("password");
		pwdField.addValue(password);
		FormField usrField = new FormField("username");
		usrField.addValue(username);
		
		df.addField(pwdField);
		df.addField(usrField);
		regRegister.addExtension(df);
		
		PacketCollector subscription = conn.createPacketCollector(new  
PacketTypeFilter(Presence.class));
		
		conn.sendPacket(regRegister);
		
		// 4.1.1.6 Gateway verifies that registration information provided  
by Jabber User is valid
		response = (Registration) collector.nextResult();
		XMPPError error = response.getError();
----->>>	if(error != null) { /// Here an error is found
			throw new Exception("Cannot register to the gateway : " +  
error.toString() + " user '" + username + "' password '" + password +  
"'");
		}






More information about the JDev mailing list