[ejabberd] 403 forbidden error when publishing using pubsub / Setting node configuration

shahzad bhatti shahbhat at gmail.com
Thu May 13 02:59:55 MSD 2010


I am trying to publish a message from Javascript to Ejabbered using Bosh
protocol, but I am getting 403 forbidden error. Here is my request from the
browser:

<body rid='2689241426' xmlns='http://jabber.org/protocol/httpbind'
sid='7d392f206823c5dd8be5d01bc11c422bd655b879'><iq
from='bdc2fcb2-b085-40d1-9ff4-18f1d7fd6629 at optionshouse.local'
to='pubsub.optionshouse.local' type='set' id='1500:publishnode'
xmlns='jabber:client'><pubsub
xmlns='http://jabber.org/protocol/pubsub'><publish
node='IncomingSymbols'
jid='bdc2fcb2-b085-40d1-9ff4-18f1d7fd6629 at optionshouse.local'><item><entry>MSFT</entry></item></publish></pubsub></iq><iq
from='bdc2fcb2-b085-40d1-9ff4-18f1d7fd6629 at optionshouse.local'
to='pubsub.optionshouse.local' type='set' id='1501:publishnode'
xmlns='jabber:client'><pubsub
xmlns='http://jabber.org/protocol/pubsub'><publish
node='IncomingSymbols' jid='bdc2fcb2-b085-40d1-9ff4-18f1d7fd6629
@optionshouse.local'><item><entry>MSFT</entry></item></publish></pubsub></iq></body>


And here is response:

<body xmlns='http://jabber.org/protocol/httpbind'><iq
xmlns='jabber:client' from='pubsub.optionshouse.local'
to='bdc2fcb2-b085-40d1-9ff4-18f1d7fd6629 at optionshouse.local/1911053186127370406921958'
type='error' id='1501:publishnode'><pubsub
xmlns='http://jabber.org/protocol/pubsub'><publish
node='IncomingSymbols'
jid='bdc2fcb2-b085-40d1-9ff4-18f1d7fd6629 at optionshouse.local'><item><entry>MSFT</entry></item></publish></pubsub><error
code='403' type='auth'><forbidden
xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></iq></body>



Also, on the server side I am trying to set the configuration of node using
exmpp, but my syntax is not quite correct and is failing. Can someone point
what's missing?

define(XMLEL_FIELD(Type, Var, Value),
    #xmlel{name = field,
       attrs =
       [#xmlattr{name = type, value = Type},
       #xmlattr{name = var, value = Var}],
       children = [#xmlel{name = value, children =
[#xmlcdata{cdata=Value}]}]}).
-define(XMLEL_BOOL_FIELD(Var, Value), ?XMLEL_FIELD(<<"boolean">>, Var,
Value)).
-define(XMLEL_TEXT_FIELD(Var, Value), ?XMLEL_FIELD(<<"text-single">>, Var,
Value)).
-define(XMLEL_LIST_FIELD(Var, Value),
    #xmlel{name = field,
       attrs =
       [#xmlattr{name = type, value = <<"list-single">>},
        #xmlattr{name = var, value = Var}],
       children = [
            #xmlel{name = option, attrs = [],
                children = [#xmlel{name = value, children =
[#xmlcdata{cdata=Value}]}]
                }
       ]
    }).



    Options =  #xmlel{name = 'x', ns = ?NS_DATA_FORMS, children = [
      ?XMLEL_LIST_FIELD(<<"pubsub#access_model">>, <<"authorize">>),
      ?XMLEL_LIST_FIELD(<<"pubsub#publish_model">>, <<"publishers">>),
      ?XMLEL_BOOL_FIELD(<<"pubsub#notify_sub">>, <<"true">>),
      ?XMLEL_BOOL_FIELD(<<"pubsub#persist_items">>, <<"false">>),
      ?XMLEL_TEXT_FIELD(<<"pubsub#max_items">>, <<"10">>),
      ?XMLEL_TEXT_FIELD(<<"pubsub#item_expire">>, <<"10000">>),
      ?XMLEL_TEXT_FIELD(<<"pubsub#max_payload_size">>, <<"8192">>) %8K
      ]},
    IQ = exmpp_client_pubsub:set_node_configuration(Service, Symbol,
Options),
    PacketId = exmpp_session:send_packet(MySession,
exmpp_stanza:set_sender(IQ, MyJID)),
    PacketId2 = erlang:binary_to_list(PacketId),
    receive #received_packet{id=PacketId2, raw_packet=Raw} ->
      case exmpp_iq:is_error(Raw) of
        true -> {error, Raw};
        _ -> ok
      end
    end,



Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.jabber.ru/pipermail/ejabberd/attachments/20100512/8adac32e/attachment.html>


More information about the ejabberd mailing list