Hi,
I´m trying to detect gateways to other protocols using Smack. I´m using this code from the forums, that is supposed to work well.
I´m using the class “ServiceDiscoveryManager” and I´m getting an error “service-unavailable(503)”
This is the code I´m using.
We can call this function with “msn” and the current connection and look for an MSN gateway for example.
public static boolean isGateway(String gwPrefix,XMPPConnection connection) throws XMPPException {
System.out.println("starting for gateway " + gwPrefix);
ServiceDiscoveryManager discoveryManager = new ServiceDiscoveryManager(connection);
String connHost = connection.getHost(); //getHost();
String gatewayJid = gwPrefix + “.” + connHost;
System.out.println("discoverin item "+gatewayJid+" on " + connHost);
DiscoverItems items = discoveryManager.discoverItems(connHost);
Iterator itemIter = items.getItems();
boolean gatewaySupported = false;
while (itemIter.hasNext()) {
DiscoverItems.Item item = (DiscoverItems.Item) itemIter.next();
if (item.getEntityID().startsWith(gwPrefix)) {
gatewaySupported = true;
}
}
return gatewaySupported;
}
I have spent several hours and I haven´t found the clue.
Thanks in advance