powered by Jive Software

PubSub over BOSH always returning disco#info


I’m trying to get the hang of using PubSub (and XMPP in general) over BOSH. I can talk and authenticate to the server fine, but when I send a pubsub disco#items stanza (or a create node… haven’t tried anything else) it always returns the disco#info response. This is the first stanza I send after auth success and roster download.

The request stanza I’m trying to use is:

<body rid="145621" sid="58319e92" xmlns="http://jabber.org/protocol/httpbind">
<iq type="get" to="portal.cammesg01">
   <query xmlns="http://jabber.org/protocol/disco#items"/>

I haven’t changed any server settings (openfire 3.6.4). I was hoping for the server to return me something like:

<iq type='result' from='portal.cammesg01' to='portal@cammesg01/portal'>
<query xmlns='http://jabber.org/protocol/disco#items'>    <item/>

because I haven't setup any nodes yet. But what I get is:
<body xmlns='http://jabber.org/protocol/httpbind'>
<iq type="result" from="cammesg01"
category="server" name="Openfire Server"
type="im"/><identity category="pubsub"
and so on.

Any ideas what I've missed out here? I'm trying to go by the spec and a prayer lol. I can provide more debug output if required.

The ultimate goal here is to have a "System" user that creates/manages nodes through a web interface, then users subscribe to the things the system user publishes.

This is the stanza you require to get the nodes that exist
in the pubsub service.  You are not specifying the pubsub
service as the destination for your request.
Any requests for pubsub need to be addressed to the pubsub
<iq type="get" to="pubsub.portal.cammesg01">
   <query xmlns="http://jabber.org/protocol/disco#items"/>


I’ve changed the stanza to look like

<body rid="747242" sid="629fba71" xmlns="http://jabber.org/protocol/httpbind">
    type="get"     to="pubsub.portal.cammesg01"
<query xmlns="http://jabber.org/protocol/disco#items"/>

but it is still returning a disco#info stanza?

I thought maybe it was because I didnt’ have any nodes setup (although this seems bad from a spec point-of-view), so I tried to send a

<body rid="699996" sid="b18e18f4" xmlns="http://jabber.org/protocol/httpbind">
<iq     type="set"     from="portal@cammesg01/PORTAL"
        <pubsub xmlns="http://jabber.org/protocol/pubsub">
        <create node="portal" />

That one returned a disco#info too!

Do I have to manually set any of these properties?

Determines if anyone can create nodes

List of JID’s of those that are allowed to create nodes


since 3.5.0 / JM-1262: Disable pubsub by setting this value to false


Turns the ability to have multiple subscriptions to a node on/off

Specifies the JID of the root node creator

Specifies the id of the root collection node

The pubsub service name

Sets the specified JID’s as pubsub admins

Or does PubSub work “out the box”?

No, you shouldn’t have to set anything, the default values should be fine. If anything, you would get errors if the service didn’t exist. I notice that you do not have an id set for your request stanza’s. Are they set before they are sent to the server? They would be required to match the response to the request.

I don’t know how you are sending these stanza’s, but if you can monitor the sent and received raw stanzas this might give you some idea as to what is going wrong.

Hi Rcollier,

Luckily I’ve already built in Raw stanza logging immediately before and after the exec is performed, which has helped me get past all the authentication side of things.

Here is where I’m up-to (I’ve commented out the handling of the roster, as it is getting confused between that and the pubsub disco#info response… need to build in a check to see if it is pub-subbing!). Stuff being sent to the server is on the left, stuff it’s got back is on the right. (The logging put in line-breaks every so often so I can read it easier… the stanza’s aren’t being affected by that)

27 statements took 1s

http://[apache proxy bound domain here]/bosh
Send >>

<?xml version="1.0"?><body hold="1"

secure=“true” rid=“572527” to="cammesg01"
wait=“60” xmpp:version=“1.0” xml:lang="en"
Receive <<

DIGE ST-MD5PLAINCRAM-MD5zlib 4 Info Authenticating... 5 Info Attempting DIGEST-MD5 Authentication... 6 Send >> 7 Receive << cmVhbG09ImNhbW1lc2cwM SIsbm9uY2U9Ikk2Z2xMT05scTU4a3JDSE1yZ2t4Tms1L3Z1NGp0M2tFTTV5UmhnMFMiLHFvcD0i YXV0aCIsY2hhcnNldD11dGYtOCxhbGdvcml0aG09bWQ1LXNlc3M= 8 Send >> dXNlcm5hbWU9InBvcnRhb CIscmVzcG9uc2U9ImNiOTkxNjBkZjhjYjlmMjU4MjE2MjMzYzhlMmM5ZThjIixjaGFyc2V0PSJ1 dGYtOCIsbmM9IjAwMDAwMDAxIixxb3A9ImF1dGgiLG5vbmNlPSJJNmdsTE9ObHE1OGtyQ0hNcmd reE5rNS92dTRqdDNrRU01eVJoZzBTIixkaWdlc3QtdXJpPSJ4bXBwL2NhbW1lc2cwMSIscmVhbG 09ImNhbW1lc2cwMSIsY25vbmNlPSJmVXVYSitPYVdaNkRBT0lqeDRsTWhicjlmRzJXK3dTR3hBc E1wMjNPQ1RvPSI= 9 Receive << cnNwYXV0aD0zZGQ0Y2RhM jM0NmI5MGU2NWEyZTlmM2E2OTczNTUwNg== 10 Info Authentication Successful 11 Send >> <?xml version="1.0"?> 12 Receive << zlib 13 Info Binding to the server stream 14 Send >> PORTA L 15 Receive << portal@cam mesg01/PORTAL 16 Info Starting Session... 17 Send >> 18 Receive << 19 Send >> &l t;show>chatOnline 20 Receive << Available1 21 Info Requesting Feature List... 22 Send >> < /body> 23 Receive <<

[… Pretend there is a big roster list here. I’m not posting that one!.. ]

Requesting PubSub Items List…
Send >>

< ;/body> 26 Receive << & lt;feature var="[http://jabber.org/protocol/pubsub#retrieve-default](http://jabber.org/protocol/pubsub#retrieve-default)"/>< feature var="[http://jabber.org/protocol/pubsub#collections](http://jabber.org/protocol/pubsub#collections)"/><feature var="[http://jabber.org/protocol/pubsub#retrieve-subscriptions](http://jabber.org/protocol/pubsub#retrieve-subscriptions)"/&g t; ;& lt;feature var="[http://jabber.org/protocol/pubsub#get-pending](http://jabber.org/protocol/pubsub#get-pending)"/> < feature var="jabber:iq:version"/><feature var="[http://jabber.org/protocol/pubsub#presence-notifications](http://jabber.org/protocol/pubsub#presence-notifications)"/&g t; ; ;

That’s as far as I’m up to at the moment. I haven’t build a response for the pubsub stuff yet as I’ve yet to get the correct response from the server!

I’ve also tried sending an empty stanza, which also returns the same result.

It feels like I’m missing a fundemental step or attribute and the server isn’t telling me, just returning what it supports (it does seem to recognise it is PubSub though).

OK. I think I’m past this issue now. Just by handling the disco#info and then immediately firing the disco#items after it seems to return some items.

Thanks for the help rcollier