How to respond to an IQ?

Hi everyone,

I’m trying to make my smack client respond to an IQ sent from another client :

I’ve created an IQProvider object that has a parseIQ method, returning an IQ object.

The parseIQ method is correctly called when the IQ is received, but I can’t see my IQ response on the other client.

I’m probably doing something wrong… any idea ?

Thanks a lot in advance

Here is my code :

ProviderManager pm = ProviderManager.getInstance();

IQProvider provider = new IQProvider() {


public IQ parseIQ(XmlPullParser xmlpullparser) throws Exception {

String newState=xmlpullparser.getAttributeValue("", “state”);

String jid=xmlpullparser.getAttributeValue("", “jid”);

String response = callback(newState, jid);

IQ iqResult = new IQ() {


public String getChildElementXML() {

String s = “<changestate xmlns=”“namespace”" result="“response”"/>";

return s;



return iqResult;



pm.addIQProvider(“changestate”, namespace, provider);