what does feature not implemented response mean

2019-08-21 13:21发布

问题:

I am trying to send a custom IQ to ejabberd server from android app and I have this following class

public class IQCustom extends IQ {


    public final static String childElementName = "query";
    public final static String childElementNamespace = "jabber:iq:conversations";





    public IQCustom(String userFrom, String server)
    {

        super( childElementName, childElementNamespace );
        this.setType(Type.get);


        setTo( server );
        setFrom( userFrom );
    }


    @Override
    protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder xml) {




        xml.rightAngleBracket();

        xml.halfOpenElement("abc");
        xml.attribute("op","sum");
        xml.rightAngleBracket();
        xml.closeElement("abc");



        return xml;
    }
}

and these are the IQ logs I am getting:

    D/SMACK: SENT (1): <iq to=‘example.com' id='BQ8wt-16' type='get'><query xmlns='jabber:iq:conversations'><abc op='sum'></abc></query></iq>
 D/SMACK: RECV (1): <iq to='testing7@example.com/Smack' from='example.com' type='get' id='BQ8wt-16'><query xmlns='jabber:iq:conversations'><abc op='sum'/></query></iq>
 D/SMACK: RECV (1): <r xmlns='urn:xmpp:sm:3'/>
 D/SMACK: SENT (1): <iq to='example.com' id='BQ8wt-16' type='error'><error type='cancel'><feature-not-implemented xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></iq>
 D/SMACK: SENT (1): <r xmlns='urn:xmpp:sm:3'/>
 D/SMACK: SENT (1): <a xmlns='urn:xmpp:sm:3' h='4'/>
 D/SMACK: RECV (1): <a h='5' xmlns='urn:xmpp:sm:3'/>

I understood the reason of first receive iq that I getting but I didn’t understand the reason for the iq:

D/SMACK: SENT (1): <iq to='example.com' id='BQ8wt-16' type='error'><error type='cancel'><feature-not-implemented xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></iq>

EDIT

This is the module which is supposed to act when I send the above query:

-module(mod_conversations).
-behaviour(gen_mod).
%% ====================================================================
%% API functions
%% ====================================================================
-export([start/2, stop/1, process_local_iq/3]).
-include("ejabberd.hrl").
-include("logger.hrl").
-include("xmpp.hrl").
-define(NS_IQ_CUSTOM, <<"jabber:iq:conversations">>).
start(Host, _) ->
    gen_iq_handler:add_iq_handler(ejabberd_local, Host, ?NS_IQ_CUSTOM, ?MODULE, process_local_iq, one_queue),
    ?INFO_MSG("Inside mod_conversation",[]),
ok.
stop(Host) ->
    gen_iq_handler:remove_iq_handler(ejabberd_local, Host, ?NS_IQ_CUSTOM),
ok.
process_local_iq(From,_ ,IQ) ->
    From,
    ?INFO_MSG("Inside mod_conversation, IQ is ~p~n ",[IQ]),
    Sum = 2+2,
    IQ.

And Inside gen_iq_handler() I saw that handler were already registered, So I am confused now that what does implementing the feature mean.

I only want to send the value of Sum in a responding iq to the client, for that how exactly should I register this feature and how can i send a iq response from this module to the client/user without any error iq's?

回答1:

Have you implemented the feature with ns xmpp-stanzas?