Format of result will be this.
<iq from='52@localhost' to='20@localhost/Gajim' id='253' type='result'>
<query xmlns='someName'>
<item subscription='both' jid='1@localhost'/>
</query>
</iq>
I am trying to send a custom iq query with the following format.
<iq xmlns="Name" type="get" id="253">
<query xmlns="someName">
<auth type='token'>asd</auth>
</query>
</iq>
From this I understand that I need to send a query with a authorization type token(token id ). Here is my try at that.
final IQ iq = new IQ() {
@Override
public String getChildElementXML() {
return "<query xmlns='someName'auth type="+t_id"+"asd<................'</query>"; // I am confused on how to write here
}
};
iq.setType(IQ.Type.get);
connection.sendPacket(iq); // connection is an XMPPTCPConnection object.
I am confused on how to complete this getChildElementXML() and furthermore I get an error when I try to instantiate a new IQ because I need to implement some builder method. Should I create a new class for sending custom IQ queries?Can someone show how to do it?
Note: Constructive feedback is appreciated, I can make the question clearer if someone points out an ambiguity.