Making Sense of the Serivces

How do you know that a JID powwow.batcomputer is a conference service? Unless JIDs follow a certain convention, trying to programmatically determine a service from a name is not going to be sufficient (see last blog). What you really need to do is after you have gotten the services of the JID, you need to ask the server for more info about the JID by sending it a disco#info. Here is the code snippet that shows you how to do that

DiscoverItems items = mgr.discoverItems(HOST);
Iterator<DiscoverItems.Item> iter = items.getItems();

DiscoverInfo info = null;
while (iter.hasNext()) {
   DiscoverItems.Item i =;
   //Some servers do not return more info on a particular JID
   //will throw exception,
   try {
      info = mgr.discoverInfo(i.getEntityID());
   } catch (Exception e) {
   Iterator<DiscoverInfo.Identity> idIter = info.getIdentities();
   while (idIter.hasNext()) {
      DiscoverInfo.Identity id =;
      System.out.println(“\t ” + id.toXML());

If we run the above on, we get the following

<item jid=””/>
<item jid=”” name=”Multi-User Chat”/>
         <identity category=”conference” name=”Isode M-Link Conferencing” type=”text”/>

The identity of is a conference and the type is text. As it turns out the entries the identity attributes are standard and they are defined in here (its one of the easiest specs to read). So we know from the specs that conference is a text based conferencing. However XMPP servers can also support IRC style chat, in which case type would be irc.

But I’m digressing. The whole purpose of my original exercise was to discover pubsub services. So I ran the above code on my openfire server and here’s what I got back

<item jid=”pubsub.batcomputer” name=”Publish-Subscribe service”/>
   <identity category=”pubsub” name=”Publish-Subscribe service” type=”service”/>

<item jid=”search.batcomputer” name=”User Search”/>
   <identity category=”directory” name=”User Search” type=”user”/>
<item jid=”conference.batcomputer” name=”Public Chatrooms”/>
   <identity category=”conference” name=”Public Chatrooms” type=”text”/>
  <identity category=”directory” name=”Public Chatroom Search” type=”chatroom”/>
<item jid=”proxy.batcomputer” name=”Socks 5 Bytestreams Proxy”/>
   <identity category=”proxy” name=”SOCKS5 Bytestreams Service” type=”bytestreams”/>

Note the pubsub category and the type which is a service.

%d bloggers like this: