5

嗨,我在使用 asmack 库注册时遇到错误。注册代码

Log.d(TAG, "creating new server account...");
                    AccountManager am = new AccountManager(connection);
                    Log.i("Registration Details:","UaerName = "+config.userName + "  Password is ==" + config.password);
                    am.createAccount(config.userName, config.password);

我得到的smack日志:

<main>09-14 12:18:08.132: D/yaxim.SmackableImp(5933): creating new server account...
09-14 12:18:08.142: D/SMACK(5933): 12:18:08 PM SENT (1089044856): <iq id="Ii5WG-0" to="myHost" type="get"><query xmlns="jabber:iq:register"></query></iq>
09-14 12:18:08.522: D/SMACK(5933): 12:18:08 PM RCV  (1089044856): <iq type="result" id="Ii5WG-0" from="myHost"><query xmlns="jabber:iq:register"><username/><password/><email/><name/><x xmlns="jabber:x:data" type="form"><title>XMPP Client Registration</title><instructions>Please provide the following information</instructions><field var="FORM_TYPE" type="hidden"><value>jabber:iq:register</value></field><field var="username" type="text-single" label="Username"><required/></field><field var="name" type="text-single" label="Full name"/><field var="email" type="text-single" label="Email"/><field var="password" type="text-private" label="Password"><required/></field></x></query></iq>
09-14 12:18:08.562: D/SMACK(5933): 12:18:08 PM SENT (1089044856): <iq id="Ii5WG-1" to="myHost" type="set"><query xmlns="jabber:iq:register"><email></email><password></password><username></username><name></name></query></iq>
09-14 12:18:08.933: D/SMACK(5933): 12:18:08 PM RCV  (1089044856): <iq type="error" id="Ii5WG-1" from="myHost" to="myHost/8f0bf952"><query xmlns="jabber:iq:register"><email/><password/><username/><name/></query><error code="500" type="wait"><internal-server-error xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></error></iq>
09-14 12:18:08.953: I/yaxim.Service(5933): connectionFailed: internal-server-error(500)</main>

在这里我得到了内部服务器错误。错误代码= 500。任何人都可以帮助我。提前致谢。

我正在使用 asmack-issue 15.jar 库。

4

1 回答 1

6

我解决了这个问题.. createAccount(config.userName, config.password); 中有问题 smack-issue 15.jar 库的方法。

使用另一种方法 createAccount 解决了我的问题。

AccountManager am = new AccountManager(mXMPPConnection);
                Log.i("Registration Details:", "UaerName = "
                        + mConfig.userName + "  Password is =="
                        + mConfig.password);
                Map<String, String> mp = new HashMap<String, String>();

                // adding or set elements in Map by put method key and value
                // pair
                mp.put("username", mConfig.userName);
                mp.put("password", mConfig.password);
                mp.put("name", mConfig.userName);
                mp.put("email", "");

                // am.createAccount(mConfig.userName, mConfig.password);
                am.createAccount(mConfig.userName, mConfig.password, mp);
于 2012-10-12T04:19:05.500 回答