powered by Jive Software

User Search (JEP-0055) with Smack 2.1.0

I am using the following code to try to get a search form from a local instance of Jive Messenger (2.3.0) that has user search enabled:

UserSearchManager search = new UserSearchManager(currentConnection);

try {

searchForm = search.getSearchForm(searchServiceName);

} catch (XMPPException xmppe) {

logger.error(“Error initializing search form fields”, xmppe);

}

/code

searchForm.getSearchForm() returns null even though I can see that a proper response is being sent back from the server. I can trace the problem to a null value for the packetExtension variable of the server response Packet.

Any ideas why I can’'t get the search fields?

Thanks

Try changing your catch to:

} catch (Exception e) {

logger.error(“Error initializing search form field”, e);

}

/code

also can you post the packets that are being transmitted back and forth? Inside the smack debugger choose raw sent and raw recieved, post any relevant packets.

Alex

Hey Alex,

There are no exceptions thrown in that try/catch block. I changed the XMPPException to Exception anyway, but no difference.

The following are the raw packets (please ignore the to and from fields- I removed the values)

Raw Sent

/code

Raw Received

/code

Sorry about the xml formatting mess.

thanks for helping…

Hi Robert,

It looks like the to in your send packet is empty for some reason, what is the search service jid you are using. An example valid get packet would be:

Cheers,

Derek

I mentioned in my post that i removed the ‘‘to’’ and ‘‘from’’ attribute values intentionally. Sorry, i guess I should’'ve made that clearer or put in fake values.

Ok,

So smack is reading the packet, otherwise an exception would be thrown. The only way it would return null if it couldn’'t get the jabber:x:data extension from the packet. Can you check to make sure under the Smack Info panel of the debugger that org.jivesoftware.smackx.provider.DataFormProvider is listed under “Installed Extension Providers”? Also, under Installed IQ Providers make sure that org.jivesoftware.smackx.search.UserSearch$Provider is listed.

Alex

Hi Alex, I checked and have both listed in the info panel.

I think I got it- I had the wrong IQ Provider installed for user search. I wasn’‘t using the right one, which is org.jivesoftware.smackx.search.UserSearch.Provider. I’'m still very new to this. Thanks for the help Alex, you led me in the right direction.

Glad the issue was resolved

Alex