Joe_Lin
December 6, 2010, 11:41pm
1
Is there anyway to allow for ‘proxy’ PubSub subscription in OpenFire?
I want to subscribe to a node in pubsub service in OpenFire for some entities that I have received message from. The subscription request is sent from me in place of the other entities. I’m login to OpenFire as admin. But I’m getting a ‘bad-request’ error:
<invalid-jid xmlns="[http://jabber.org/protocol/pubsub#errors](http://jabber.org/protocol/pubsub#errors)"/>
<subscribe xmlns="[http://jabber.org/protocol/pubsub](http://jabber.org/protocol/pubsub)"/>
<invalid-jid xmlns="[http://jabber.org/protocol/pubsub#errors](http://jabber.org/protocol/pubsub#errors)"/>
The subscribe element is wrong. It should not have the xmlns attribute and it requires a node and jid attribute. Here is valid example.
<subscribe node='princely_musings' jid='francisco@denmark.lit'/>
Paul42
August 1, 2013, 3:19pm
3
I’m trying to use the Smack library to subscribe to a Node in openfire and I’m getting this same error.
My code is as follows:
public Node subscribeToNode(String topic, String user, ItemEventListener itemListener) throws XMPPException {
LeafNode node = psm.getNode(topic);
node.addItemEventListener(itemListener);
node.subscribe(user);
return node;
}
Where topic is a valid topic already created on the server, and user is a valid user name on the server.
The message sent is:
And the response is:
<subscribe xmlns="[http://jabber.org/protocol/pubsub](http://jabber.org/protocol/pubsub)"/>
<invalid-jid xmlns="[http://jabber.org/protocol/pubsub#errors](http://jabber.org/protocol/pubsub#errors)"/>
The initial node configuration is as follows:
public void createTopicNode(String topic, String DataType, boolean persistent) throws XMPPException {
ConfigureForm form = new ConfigureForm(FormType.submit);
form.setPersistentItems(persistent);
form.setDataType(DataType);
form.setDeliverPayloads(true);
form.setNotifyDelete(true);
form.setNotifyRetract(true);
form.setAccessModel(AccessModel.open);
form.setPublishModel(PublishModel.open);
form.setSubscribe(true);
Node n = psm.createNode(topic, form);
}
Everything looks right to me, so I’m not sure what’s going wrong.
Paul42
August 1, 2013, 4:28pm
4
Figured it out, I think.
It’s the mismatch in JIDs, the system is only sending jid=“user”. It seems to me that by the spec, Openfire should automatically be able to figure out that “user@localhost.localdomain” is the full JID. In fact, it seems to me that it is, given the return error value.
http://xmpp.org/extensions/xep-0060.html#subscriber-subscribe-error-nomatch
This is also odd from the perspective of using the API, since I can login with just the bare username without including the full domain.