【问题标题】:XMPP service-unavailable(503) error during UserSearchManagerUserSearchManager 期间出现 XMPP 服务不可用(503)错误
【发布时间】:2013-04-02 08:59:22
【问题描述】:

今天早上我遇到了一个复杂的问题。 我正在使用 XMPP 创建聊天应用程序。我登录成功,可以和用户聊天了。

现在,我想在 XMPP 服务器中搜索用户。但我收到错误 service-unavailable(503)

这是我的代码:-

 UserSearchManager usm = new UserSearchManager(connection);
Form searchForm = usm.getSearchForm("search."+connection.getServiceName());
Form answerForm = searchForm.createAnswerForm();
answerForm.setAnswer("Username", true);
answerForm.setAnswer("search", "rahul@opensip01");
ReportedData data = usm.getSearchResults(answerForm, "search."+connection.getServiceName());
System.out.println("data is "+data);

还有一点。当我使用 getSearchServices() 访问 http://www.igniterealtime.org/builds/smack/docs/3.2.2/javadoc/org/jivesoftware/smackx/search/UserSearchManager.html#getSearchServices() 时。我得到了零值。

这是代码:-

UserSearchManager usm = new UserSearchManager(connection);
System.out.println(usm.getSearchServices().size());

我已经在我的 XMPP 服务器中安装了高级搜索插件。但仍然是零输出。

【问题讨论】:

    标签: android xmpp chat smack asmack


    【解决方案1】:

    当 serach 不使用 @ 时,只需像这样输入名称

    answerForm.setAnswer("search", "rahul");

    【讨论】:

    • 我绑定了你的代码。它对我有用。您是否将提供程序添加到您的代码和使用的任何版本?
    • 对不起,我没明白。这是我的连接代码。 ** 字符串主机 = "xxx.xxx.xxx.xxx";字符串端口 = "5222";字符串服务 = "xxx.xxx.xxx.xxx";字符串用户名 = "xxx"; String password = "xxx";ConnectionConfiguration connConfig=new ConnectionConfiguration(host, Integer.parseInt(port),service);连接 = 新 XMPPConnection(connConfig);连接.连接(); connection.login(用户名,密码);存在存在=新存在(Presence.Type.available); connection.sendPacket(出席);**
    • 我在我的 xmpp 服务器中安装了高级搜索插件。
    • 尝试在connection.connect();之前添加这个SmackAndroid.init(context);。
    • 这个包导入org.jivesoftware.smack.SmackAndroid;没有找到。我需要更改我的 jar 文件吗
    猜你喜欢
    • 2015-01-14
    • 2013-07-29
    • 2012-04-29
    • 2015-09-27
    • 2013-09-18
    • 1970-01-01
    • 1970-01-01
    • 2021-01-07
    相关资源
    最近更新 更多