1
ejabberd 서버의 Android에서 asmack 라이브러리를 사용하여 내 XMPP 클라이언트를 사용하여 새 사용자를 등록하려고합니다.안드로이드에서 asmack을 사용하여 잘못된 요청 400 오류가 발생했습니다.
bad-request(400)
at org.jivesoftware.smack.AccountManager.createAccount(AccountManager.java:243)
at in.ui.MainActivity$1$1$1.run(MainActivity.java:316)
at java.lang.Thread.run(Thread.java:841)
다음 코드입니다 : : 문제는 내가 오류 & 사용자가 서버에 생성되지 않고 다음 얻고 있다는 것입니다
_xmppUsername = XMPPConfig.getStringUserInfoValue (XMPPConfig.XMPP_CLIENT_ID);
_xmppPassword = XMPPConfig.getStringUserInfoValue (XMPPConfig.XMPP_CLIENT_PASSWORD);
_xmppHost = XMPPConfig.getStringUserInfoValue (XMPPConfig.XMPP_HOST);
try {
_xmppPortNo = Integer.parseInt (XMPPConfig.getStringUserInfoValue (XMPPConfig.XMPP_PORT));
} catch (Exception e) {
e.printStackTrace();
Log.e (TAG, e.getMessage());
}
_xmppServiceName = XMPPConfig.getStringUserInfoValue (XMPPConfig.XMPP_SERVICE_NAME);
ConnectionConfiguration conConfig = new ConnectionConfiguration (_xmppHost, _xmppPortNo, _xmppServiceName);
_xmppConnection = new XMPPConnection (conConfig);
if (!_xmppConnection.isAuthenticated()) {
login();
}
/*
* If connection has not been established or had been established &
* broken again then login
*/
@Override
public void onShow (final DialogInterface dialog) {
Button positiveButton = _dlgRegistration.getButton (DialogInterface.BUTTON_POSITIVE);
positiveButton.setOnClickListener (new View.OnClickListener() {
@Override
public void onClick (View v) {
// Creating registration thread
new Thread (new Runnable() {
@Override
public void run() {
String clientID = null;
String password = null;
clientID = "user" + XMPP_SERVICE_NAME;
try {
// Getting hash password from UUID
password = "password";
Log.i (TAG, clientID + password);
} catch (NoSuchAlgorithmException e1) {
e1.printStackTrace();
} catch (UnsupportedEncodingException e1) {
e1.printStackTrace();
}
}
AccountManager manager = _xmppConnection.getAccountManager();
try {
// Creating account on the server
manager.createAccount (clientID, password, attr);
}
} catch (XMPPException e) {
e.printStackTrace();
}
}
}).start();
}
});
안녕하세요. 서비스 이름이 필요하지 않은 곳에 {clientID = "user"+ XMPP_SERVICE_NAME}을 (를) 언급했습니다. 내 경우에는 사용자 이름 자체에 위에 언급 한 구조가 포함되어 있습니다. 나는 내가 좋아 할 거라고 내 실제 클라이언트를 원하는이 된 ClientID = "[email protected]"+ XMPP_SERVICE_NAME 내가 다음 서비스 이름을 언급하지 않는 여기 경우 내 클라이언트는 나는이 처럼 될 것이다 것 clientID = "[email protected]" 이것은 내 사용자가 "abc"이고 내 서비스가 "xyz.com"임을 의미합니다. 다음과 같은 형식으로 사용자를 생성하려면 어떻게해야합니까? user = [email protected] 고맙습니다. :) – codemaniac