Result stanza is not recognized when IQProvider is active


When registering an IQProvider, I don’t get an answer in the StanzaListener, I might not have understood precisely how IQProviders work, but don’t know where to start.

I’m using Smack to send and receive some custom IQ’s. Here’s the code I’m using to send the custom IQ.

    xmppConnection.sendIqWithResponseCallback(iq, new StanzaListener() {
        public void processPacket(Stanza packet) throws SmackException.NotConnectedException, InterruptedException {
            handleReply((WedooIQ) packet);
    }, new ExceptionCallback()
        public void processException(Exception exception) {

All right. I’m certain that the correct answer is sent, because debug mode is showing me what I want to see. The result stanzas are provided by a node client on the other side, so that’s not of concern for this question.

Here’s what’s not working out for me: I’m getting an answer in the StanzaListener(), but of course, I can’t do much with it if I don’t want to do all the parsing on my own. I’m told to implement a IQProvider and register it - so I do:

ProviderManager.addIQProvider(Xxx.ELEMENT_NAME, Yyy.NAMESPACE, new ZzzIQProvider());

But when this is registered, I don’t get an answer anymore and instead, there’s a timeout exception after those 5 seconds

System.err: org.jivesoftware.smack.SmackException$NoResponseException: No response received within reply timeout. Timeout was 5000ms (~5s). Waited for response using: IQReplyFilter ......

I was figuring the IQProvider would make it so that I get a more usable object in the StanzaListener from above. How does this work? I have read the documentation on this on the tml, but I don’t understand how to receive IQs, I only understand how to register a provider without any visible effect to me.

Probably just missing something small here, any help is highly appreciated since I’ve been sitting on this for several days now.

Smack’s Providers are parsers. The know the details about the stanzas Smack receives and are able to produce more specialized versions of IQs or ExtensionElements.

I’ve no clue why adding a parsing should make IQ filter fail. Ideally when you set up an IQ provider for your result, you should be able to downcast the result IQ to a more specialized version: The one generated by your provider.

If I where you, I would attach an debugger to find out why the IQ result filter doesn’t match.