Hi all,
I’ve established a connection and already created 5 user ,I’m try to create a node and publish some message so that these users can subscribe to that node.
I encountered a exception when I’m trying to do pubsub and I’ve googled this exception
but their situation is different with mine (smack 4.3)
can anyone help me what should I do or there is something I need to set ?
thank you!!
org.jivesoftware.smack.XMPPException$XMPPErrorException:
XMPP error reply received from pubsub.mydomain: XMPPError: bad-request - modify
// Create a pubsub manager using an existing XMPPConnection
PubSubManager mgr = PubSubManager.getInstance(connection);
// Create the node
LeafNode leaf = mgr.createNode("testNode");
ConfigureForm form = new ConfigureForm(Type.submit);
form.setAccessModel(AccessModel.open);
form.setDeliverPayloads(false);
form.setNotifyRetract(true);
form.setPersistentItems(true);
form.setPublishModel(PublishModel.open);
leaf.sendConfigurationForm(form);
// Get the node
LeafNode node = mgr.getNode("testNode");
String xmlPayload = "<test xmlns=\"pubsub:mydomain\">\r\n" +
" <testTitle>qweqweqwe</testTitle>\r\n" +
" <testContent>asdasdasda</testContent>\r\n" +
"</test>";
SimplePayload simplePayload = new SimplePayload(xmlPayload);
PayloadItem<SimplePayload> item = new PayloadItem<>("testItem", simplePayload);
node.publish(item);