问题描述
我想获得该节点(在Android中使用 asmack
库),并试图在发布该节点的一些内容,但遗憾的是
当节点=(叶节点)mgr.getNode(nodeNameTxt.getText()的toString());
行被执行我收到以下错误
I am trying to get the node (in android and using asmack
library ) and trying to publish some content over that node , but unfortunatelywhen node = (LeafNode) mgr.getNode(nodeNameTxt.getText().toString());
line gets executed i am getting following error
No response from server.:
at org.jivesoftware.smackx.pubsub.packet.SyncPacketSend.getReply(SyncPacketSend.java:50)
at org.jivesoftware.smackx.pubsub.packet.SyncPacketSend.getReply(SyncPacketSend.java:61)
at org.jivesoftware.smackx.pubsub.PubSubManager.getNode(PubSubManager.java:161)
at com.bcl.NodeManager.publishNode(NodeManager.java:176)
at com.bcl.NodeManager.access$1(NodeManager.java:167)
at com.bcl.NodeManager$2.run(NodeManager.java:101)
at java.lang.Thread.run(Thread.java:1019)
下面是我的code
PubSubManager mgr = new PubSubManager(xmpp, "pubusb.example.com");
// Get the node
LeafNode node;
try {
//HERE I AM GETTING THE ERROR
node = (LeafNode) mgr.getNode(nodeNameTxt.getText().toString());
node.send(new PayloadItem("test" + System.currentTimeMillis(),
new SimplePayload("book", "pubsub:test:book", "")));
} catch (XMPPException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
即使在以下行得到执行我得到了同样的错误。
even when a following line get executed i am getting the same error
createLeaf = mgr.createNode(nodeNameTxt.getText().toString());
我真的不知道发生了什么,因为我已设置 SmackConfiguration.setPacketReplyTimeout(10000);
和服务器运行良好与stophe的JavaScript样本也。
I really dont know whats happening as i have set SmackConfiguration.setPacketReplyTimeout(10000);
and server is running fine with stophe javascript sample also.
推荐答案
我怀疑到地址不正确,并在服务器的数据包不会被发送到发布订阅服务。尝试初始化您的pubsub经理这样。
I suspect that the "to" address is incorrect and the packet is not being sent to the pubsub service in your server. Try initializing your pubsub manager like this.
PubSubManager mgr = new PubSubManager(xmpp, "pubsub.xmppdomain.com");
其中xmppdomain.com当然是你的实际的XMPP域。
where xmppdomain.com is of course your actual xmpp domain.
您可以用smack.debugEnabled上运行(或任何Android的当量)检查XML的形式发送,确认这是要去的地方是应该的。
You can run with smack.debugEnabled on (or whatever the android equivalent is) to check the XML being sent, to confirm it is going where it should be.
这篇关于同时发布到节点从服务器无响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!