AnsweredAssumed Answered

Result stanza is not recognized when IQProvider is active

Question asked by Kai B on Apr 9, 2016
Latest reply on Apr 10, 2016 by Flow

tl;dr

 

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.

 

 

    iq.setFrom(JidCreate.fullFrom(CLIENT_USER));
    iq.setTo(JidCreate.fullFrom(SERVER_USER));
    xmppConnection.sendIqWithResponseCallback(iq, new StanzaListener() {
        @Override
        public void processPacket(Stanza packet) throws SmackException.NotConnectedException, InterruptedException {
            handleReply((WedooIQ) packet);
        }
    }, new ExceptionCallback()
        @Override
        public void processException(Exception exception) {
            exception.printStackTrace();
        }
    });

 

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 https://www.igniterealtime.org/builds/smack/docs/4.1.6/documentation/providers.h 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.

Outcomes