2

Hi i need to get all registered user from xmpp server(openfire).

try {

                    UserSearchManager search = new UserSearchManager(connection);
                    Form searchForm = search.getSearchForm("search."+connection.getServiceName());
                    Form answerForm = searchForm.createAnswerForm();
                    answerForm.setAnswer("Username", true);
                    answerForm.setAnswer("search", "anbu");
                    ReportedData data = search.getSearchResults(answerForm, "search." + connection.getServiceName());
                    if (data.getRows() != null) {
                        Iterator<ReportedData.Row> it = data.getRows();
                        while (it.hasNext()) {
                            ReportedData.Row row = it.next();
                            Iterator iterator = row.getValues("jid");
                            if (iterator.hasNext()) {
                                String value = iterator.next().toString();
                                Log.i("Iteartor values......", " " + value);
                            }
                        }
                    }
                } catch (XMPPException e2) {
                    e2.printStackTrace();
                }

I have installed search.jar in admin panel. still i am getting (remote server not found). But chat is working for me.

zero323
  • 322,348
  • 103
  • 959
  • 935
Anbarasan G
  • 27
  • 1
  • 1
  • 3
  • look at my answer here : [get all users from openfire](http://stackoverflow.com/questions/36471325/getting-all-users-from-an-openfire-server-using-smack-android/39868514#39868514) – Zain Ullah Muhammad Oct 05 '16 at 08:20

1 Answers1

0

And why not using the REST API plugin for Openfire?

https://www.igniterealtime.org/projects/openfire/plugins/restapi/readme.html#retrieve-users

beaver
  • 17,333
  • 2
  • 40
  • 66
  • Your welcome. Take only care with [authentication matters](https://www.igniterealtime.org/projects/openfire/plugins/restapi/readme.html#authentication). I use the "Shared secret key" method in my own projects – beaver Dec 01 '15 at 07:13