Custom IQ: error code="503" type="CANCEL" service-unavailable

when i execute the following code

ProviderManager manager = ProviderManager.getInstance();

connection.addPacketListener(invitationListener, new PacketTypeFilter(WhiteboardInvitation.class));

manager.addIQProvider(“invitation”,“http://efycaci.com/client/protocol/whiteboard”, new WhiteboardInvitation.Provider());

I got following From Smack debug console

send msg:

received msg:

<accept>false</accept>
<service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>

The custom iq message not received to bala@sampath.efycaci.com/onTime.

I am using Openfire 3.8.3 & smack 2.2.2

Please help me to fix this problem

Code looks ok. We use it that way, too.

Maybe there’s a bug in Smack 2.2.2 and you should upgrade to 3.3.1.

I upgraded it to 3.3.1. Still i have the same problem

Ok. Then I suspect you have a problem in your provider class. Can you debug it, to make sure, your parsing logic returns an “invitation” object.

Here is my Parser & IQ

``

public class WhiteboardInvitation extends IQ {

/** The Constant ELEMENT_NAME. */

public static final String ELEMENT_NAME = "invitation";

/** The accept. */

private boolean accept = false;

/**

* Instantiates a new whiteboard invitation.

*/

public WhiteboardInvitation() {

super();

}

/**

* Sets the accept.

*

* @param accept the new accept

*/

public void setAccept(boolean accept) {

this.accept = accept;

}

/**

* Gets the accept.

*

* @return the accept

*/

public boolean getAccept() {

return accept;

}

/* (non-Javadoc)

* @see org.jivesoftware.smack.packet.IQ#getChildElementXML()

*/

public String getChildElementXML() {

StringBuffer buf = new StringBuffer();

buf.append("<" + ELEMENT_NAME + " xmlns=\"" + SVGConstants.NAMESPACE

+ "\">");

if (this.getType() != Type.GET) {

buf.append("<accept>" + String.valueOf(getAccept()) + "</accept>");

}

buf.append(getExtensionsXML());

buf.append("</" + ELEMENT_NAME + ">");

return buf.toString();

}

/**

* The Class Provider.

*/

public static class Provider implements IQProvider {

/**

* Instantiates a new provider.

*/

public Provider() {

super();

}

/* (non-Javadoc)

* @see org.jivesoftware.smack.provider.IQProvider#parseIQ(org.xmlpull.v1.XmlPullParser)

*/

public IQ parseIQ(XmlPullParser parser) throws Exception {

WhiteboardInvitation invite = new WhiteboardInvitation();

boolean done = false;

while (!done) {

int eventType = parser.next();

if (eventType == XmlPullParser.START_TAG) {

if (parser.getName().equals("accept")) {

invite.setAccept(Boolean

.parseBoolean(parser.nextText()));

}

} else if (eventType == XmlPullParser.END_TAG) {

if (parser.getName().equals(ELEMENT_NAME)) {

done = true;

}

}

}

return invite;

}

}

}

What exactly do you mean by “the custom IQ message is not received”. You do show that the stanza is received.

Do you mean it is not parsed into an Invitation object as CSH is assuming? If that is the case, run it in a debugger and break in your provider to see what is happening.