[ejabberd] EXMPP and PubSub Publishing

Tristan Sloughter kungfooguru at gmail.com
Thu Sep 24 18:43:14 MSD 2009


Wow, that seems to have worked! Thanks!

While it was of course my fault for incorrectly building the XML, it seems
there should be a nicer death of the system than simply closing the tcp
connection :). Should I make a bug report on this? Anyone has ideas how to
give enough information for the developers to know where to look?

Tristan

On Thu, Sep 24, 2009 at 9:11 AM, Pablo Polvorin <
pablo.polvorin at process-one.net> wrote:

> Hi Tristan,
>
> Not sure if this is the root cause, but when constructing the
> elements, you are mixing attributes and namespaces. In exmpp, those
> are managed in different ways, that's why your generated XML has
> *two* xmlns declarations:
>
> >            <topics xmlns=\"\" xmlns=\"http://www.chatyeo.com/2009/Topics
> \">
>
> I think what you are trying is:
> #xmlel{ns = "http://www.chatyeo.com/2009/Topics",
>           name=topics,
>            attrs=[],
>            children=[#xmlel{ns = "http://www.chatyeo.com/2009/Topics",
>                                      name=topic,
>                                     children=[#xmlcdata{cdata=
> <<"Rza">>}]}]
>
> (note that you *must* supply the ns for the child too, it won't appear
> in the XML text  because it is
>  already the default namespace).
>
> As a side note, the API is the preferred way to build elements
> (although in simple cases like this it is ok to build the records
> directly):
> -define(NS, "http://www.chatyeo.com/2009/Topics").
> exmpp_xml:element(?NS, topics, [],
>    [exmpp_xml:element(?NS, topic, [],
>        [exmpp_xml:cdata(<<"Rza">>)])])
>
>
> hope this helps
>
> 2009/9/23 Tristan Sloughter <kungfooguru at gmail.com>:
> > I build and send it with:
> >
> > XML = [#xmlel{name=topics, attrs=[#xmlattr{name=xmlns, value=
> > <<"http://www.chatyeo.com/2009/Topics">>}], children=[#xmlel{name=topic,
> > children=[#xmlcdata{cdata= "Rza"}]}]}],
> > exmpp_session:send_packet(Session,
> > exmpp_client_pubsub:publish(<<"pubsub.localhost">>,
> > "/home/localhost/another_10/test_4", XML)),
> >
> > the result for the publish that constructs the XML is:
> >
> > "<iq xmlns=\"jabber:client\" type=\"set\" to=\"pubsub.localhost\"
> > id=\"pubsub-899574700\">
> >     <pubsub xmlns=\"http://jabber.org/protocol/pubsub\">
> >       <publish node=\"/home/localhost/another_10/test_4\">
> >         <item>
> >            <topics xmlns=\"\" xmlns=\"http://www.chatyeo.com/2009/Topics
> \">
> >              <topic>Rza</topic>
> >             </topics>
> >         </item>
> >       </publish>
> >     </pubsub>
> >   </iq>"
> >
> > On Wed, Sep 23, 2009 at 2:23 PM, Pablo Polvorin
> > <pablo.polvorin at process-one.net> wrote:
> >>
> >> Hi,
> >> could you provide more details? that will help us identify what is going
> >> on.
> >> How are you building the publish stanzas?.  What XML is generated?
> >> ( you can see the xml sent  by raising ejabberds's loglevel  or  by
> >> printing
> >>  the results of  exmpp_xml:document_to_list(YourStanza) )
> >>
> >>
> >>
> >>
> >> 2009/9/23 Tristan Sloughter <kungfooguru at gmail.com>:
> >> > I've gotten creating and subscribing to nodes working fine with EXMPP
> >> > and
> >> > EJabberd 2.0.5 and 2.1rc1; however, I could only successfully publish
> a
> >> > list
> >> > of a single #xmlcdata element on 2.0.5 and nothing at all on 2.1rc1.
> >> > Obviously, I'd like to be able to publish a list of #xmlel elements as
> >> > the
> >> > item or items. There is no useful error message when I attempt to
> >> > publish to
> >> > a node I created. The only message is:
> >> >
> >> > =INFO REPORT==== 2009-09-23 13:24:37 ===
> >> > I(<0.410.0>:ejabberd_c2s:1326) :
> >> > ({socket_state,gen_tcp,#Port<0.3412>,<0.409.0>}) Close session for
> >> > another_10 at localhost/exmpp#1253730276407777
> >> >
> >> > Does anyone have any guess as to what could be causing this to happen?
> >> > I'm
> >> > lost for ideas at this point...
> >> >
> >> > Thanks,
> >> > Tristan
> >> >
> >> > _______________________________________________
> >> > ejabberd mailing list
> >> > ejabberd at jabber.ru
> >> > http://lists.jabber.ru/mailman/listinfo/ejabberd
> >> >
> >> >
> >>
> >>
> >>
> >> --
> >> Pablo Polvorin
> >> ProcessOne
> >> _______________________________________________
> >> ejabberd mailing list
> >> ejabberd at jabber.ru
> >> http://lists.jabber.ru/mailman/listinfo/ejabberd
> >
> >
> > _______________________________________________
> > ejabberd mailing list
> > ejabberd at jabber.ru
> > http://lists.jabber.ru/mailman/listinfo/ejabberd
> >
> >
>
>
>
> --
> Pablo Polvorin
> ProcessOne
> _______________________________________________
> ejabberd mailing list
> ejabberd at jabber.ru
> http://lists.jabber.ru/mailman/listinfo/ejabberd
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.jabber.ru/pipermail/ejabberd/attachments/20090924/01b452fb/attachment-0001.html>


More information about the ejabberd mailing list