item-not-found(404)尝试使用Smackx pubsub获取节点时 [英] item-not-found(404) when trying to get a node using Smackx pubsub
问题描述
我正在尝试使用最新的Smackx中继来获取然后订阅pubsub节点。但是,openfire只是向我发回一个错误:找不到项目(404)。
I'm trying to use the latest Smackx trunk to get and then subscribe to a pubsub node. However, openfire just sends me a back an error: item not found (404).
我正在从ColdFusion实例化java对象,所以我的代码片段可能看起来很有趣但是也许有人能够告诉我我忘记了什么。
I am instantiating the java objects from ColdFusion, so my code snippets might look funny but maybe someone will be able to tell me what I've forgotten.
以下是我创建节点的方法:
Here's how I create the node:
ftype = createObject("java", "org.jivesoftware.smackx.pubsub.FormType");
cform = createObject("java", "org.jivesoftware.smackx.pubsub.ConfigureForm").init(ftype.submit);
cform.setPersistentItems(true);
cform.setDeliverPayloads(true);
caccess = createObject("java", "org.jivesoftware.smackx.pubsub.AccessModel");
cform.setAccessModel(caccess.open);
cpublish = createObject("java", "org.jivesoftware.smackx.pubsub.PublishModel");
cform.setPublishModel(cpublish.open);
cform.setMaxItems(99);
manager = createObject("java", "org.jivesoftware.smackx.pubsub.PubSubManager").init(XMPPConnection);
myNode = manager.createNode("subber", cform);
以下是我试图找到它的方法(在代码的不同部分):
And here's how I am trying to get to it (in a different section of code):
manager = createObject("java", "org.jivesoftware.smackx.pubsub.PubSubManager").init(XMPPConnection);
myNode = manager.getNode("subber");
在创建之后,我似乎可以将节点发布到该节点像这样:
Immediately upon creating the node I seem to be able to publish to it like so:
payload = createObject("java", "org.jivesoftware.smackx.pubsub.SimplePayload").init("book","pubsub:test:book","<book xmlns='pubsub:test:book'><title>Lord of the Rings</title></book>");
item = createObject("java", "org.jivesoftware.smackx.pubsub.Item").init(payload);
myNode.publish(item);
然而,正是getNode()调用导致我的代码出错。
However, it is the getNode() call that is causing my code to error.
我已经通过检查我的openfire服务器使用的数据库验证了节点是否正在创建。我可以在那里看到它们,正确地归结为叶节点等。
I have verified that the nodes are being created by checking the DB used by my openfire server. I can see them in there, properly attributed as leaf nodes, etc.
有什么建议吗?
其他人在做什么与XMPP和ColdFusion做什么?
我已经取得了巨大的成功发送和接收消息与CF和Smack刚刚没有pubsub工作:))
Any advice? Anyone else out there doing anything with XMPP and ColdFusion? I have had great success sending and receiving messages with CF and Smack just haven't had the pubsub working yet :)
谢谢!
推荐答案
这已经回答:
PubSubManager类上有第二种方法接受两个参数,一个连接和一个到参数。显然Openfire需要这个到参数,经过一些实验后我发现它可以使用pubsub.your.xmpp.address
There is a second method on the PubSubManager class that accepts two arguments, a connection and a to parameter. Apparently Openfire requires this to parameter and after some experimenting i discovered that it works using pubsub.your.xmpp.address
manager = createObject("java", "org.jivesoftware.smackx.pubsub.PubSubManager").init(XMPPConnection,"pubsub.127.0.0.1");
这篇关于item-not-found(404)尝试使用Smackx pubsub获取节点时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!