Custom IQ does not work

Issue #112 resolved
Drasko Vrucinic
created an issue

I was following your example of making custom IQ from the following URL : https://sco0ter.bitbucket.io/babbler/customiq.html

And the problem is:

When you send IQ Addition request from requester at the console valid xml is being printed (using ConsoleDebbuger feature attached to XMPPSessionConfiguration).

OUT:

<iq id="52b67734-7e5a-4d10-9920-63db546ac9f5" to="responder@xmpp.serveirc.com/res" type="get"><addition xmlns="http://xmpp.rocks"><summand1>2</summand1><summand2>3</summand2></addition></iq>

and the IN message on the responder side is:

<iq from="requester@xmpp.serveirc.com/res" id="52b67734-7e5a-4d10-9920-63db546ac9f5" to="responder@xmpp.serveirc.com/res" type="get" xml:lang="en-US"><addition xmlns="http://xmpp.rocks"></addition></iq>

As you can see there are no <summand> elements.

I have tested this on Openfire and Ejabberd instances. I've also done some more investigation with the WireShark and it's not about server. Server is just routing the message, which means that the problem is on the client side.

Used babbler0.7.4.jar. Also tested with libraries from maeven repos.

Comments (7)

  1. Christian Schudt repo owner

    The issue is that the summand field is missing namespace = "rocks:xmpp:sample" in the @XmlElement annotation.

    With Java 8u60 it still works, however with the latest Java 8u141 it doesn't anymore. Seems like JAXB got a little bit more strict.

    I recommend you create a package-info.java in the same package where your JAXB annotated class is, similar as in all other package. Alternatively you can write the namespace attribute in each @XmlElement annotation, but that's a bit cumbersome and less maintainable.

  2. Log in to comment