我正在尝试使用Smack 4.2.2注册新用户,使用Openfire服务器。但是我收到了这个错误。
m.febstech.test.testxmpp D / SMACK:SENT(28): 06-08 03:23:59.387 11888-13172 / com.febstech.test.testxmpp D / SMACK:RECV(28): 06-08 03:23:59.396 11888-13163 / com.febstech.test.testxmpp D / Chatinn:org.jivesoftware.smack.XMPPException $ XMPPErrorException:从192.168.0.11收到的XMPP错误回复:XMPPError:bad-request - modify < / p>
我正在使用下面的代码,请帮助我做错了。谢谢!
try {
connectionConfiguration= XMPPTCPConnectionConfiguration.builder()
.setHost(localIp)
.setUsernameAndPassword("admin", "123456")
.setPort(5222)
.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled)
.setXmppDomain(JidCreate.domainBareFrom(localIp).asDomainBareJid())
.setHostnameVerifier(verifier)
.setHostAddress(inetAddress)
.setDebuggerEnabled(true)
.setKeystoreType(null)
.setSendPresence(true)
.build();
}catch (XmppStringprepException e) {
e.printStackTrace();
}
AbstractXMPPConnection connection = null;
connection = new XMPPTCPConnection(connectionConfiguration);try {
connection.connect();
AccountManager accountManager=AccountManager.getInstance(connection);
accountManager.sensitiveOperationOverInsecureConnection(true);
accountManager.supportsAccountCreation()
Localpart lp=Localpart.from("musab");
accountManager.createAccount(lp,"123456");
connection.login("musab", "123456");
Log.d(LOGTAG, "Musab Created and LoggedIn");
} catch (XMPPException | SmackException | InterruptedException|IOException e) {
Log.d(LOGTAG,e.toString());
}