How can I use smack api to search for user with Cisco Jabber Server?

I currently have trial Cisco Jabber 9.0.x server, I would like to use smack api to create an application (similar to spark, but not exactly the same) to let user login to Cisco Jabber. I got most of features working like presence, send message, add contact, add group,… However, I have an issue with search, here is my implementation for searching:

if (_connection == null || !_connection.isConnected()) return;

HashMap<String, String> user = null;

List<HashMap<String, String>> result = new ArrayList<HashMap<String, String>>();

try

{

String searchService = “search.” + _connection.getServiceName();

UserSearch userSearch = new UserSearch();

UserSearchManager usm = new UserSearchManager(_connection);

Collection searchServices = usm.getSearchServices(); //EMPTY SEARCH SERVICES

searchServices.stream().forEach((service) -> {

System.out.println(service);

});

Form searchForm = usm.getSearchForm(searchService); //THROWS EXCEPTION ON THIS CALL

Form answerForm = searchForm.createAnswerForm();

answerForm.setAnswer(“Username”, true);

answerForm.setAnswer(“search”, userName);

ReportedData data = userSearch.sendSearchForm(_connection, answerForm, searchService);

for (Row row : data.getRows())

{

user = new HashMap<String, String>();

user.put(“Username”, row.getValues(“Username”).toString());

result.add(user);

}

}

catch(Exception ex)

{

ex.printStackTrace();

}

Note: I used spark to login to Cisco Jabber and it could not search!

Any help is very appreciated!

Thanks

Phuong