I am building a XMPP chat client app with eclipse, java and asmack. Using tutorials and many many google searches I managed to get the buddy list working, actual chatting also works fine. My problem is with searching for more buddies to add to my contacts list. The XML to send is exemplified here : http://xmpp.org/extensions/xep-0055.html My request is :
<iq
id="search123"
from="name3@webserv.xxx.com/name3"
to="search.xxx.zzz.com"
type="set" >
<query xmlns="jabber:iq:search" >
<nick>
android
</nick>
</query>
</iq>
the response I thought I was getting was/is this:
<iq
id="search123"
from="search.xxx.zzz.com"
to="name3@webserv.telebroad.com/Smack"
type="result" >
</iq>
But using connConfig.setDebuggerEnabled(true); (and an online Telnet Client) I managed to find out that the server IS actually working correctly and it's sending the requested results, but I'm just getting what you see above. I have been at this for 4 days and my self esteem is quite low :P Here is my code concerning the IQ request and response:
Packet asdf = new Packet() {
@Override
public String toXML() {
return "<iq type='set'"+
" from='name3@webserv.xxx.com/name3'"+
" to='search.xxx.zzz.com'"+
" id='search2'"+
" xml:lang='en'>"+
" <query xmlns='jabber:iq:search'>"+
" <nick>Android</nick>"+
" </query>"+
" </iq>";
}
};
ChatList.connection.sendPacket(asdf);
Log.e("packet", "request = "+ asdf.toXML());
PacketFilter filter = new IQTypeFilter(IQ.Type.RESULT);
ChatList.connection.addPacketListener(new PacketListener() {
public void processPacket(Packet packet) {
IQ iq = (IQ)packet;
Log.e("response","incoming packet : "+ packet.toXML());
Log.e("response","incoming packet2 : "+ packet.toString());
}
}, filter);
I've tried lots of TypeFilters to no avail. I'm stumped!!
Bottom line:
1.request is being accepted correctly by server;
2.server response is correct(so says the debugger);
3.any response.toString or toXML prints out the type result XML from above(without the actual items after type='result'>.
4.I am about a week overdue on my final build for this app...help! :)