views:

55

answers:

1

This one works Ok.

curl -H 'Content-Type: application/xml'  -d " <body rid='2965554435' xmlns='http://jabber.o=utf-8' ver='1.6' xmpp:version='1.0' xmlns:xmpp='urn:xmpp:xbosh' /> " https://dashboard.onsip.com/http-bind

this one was returning an empty response

curl -H 'Content-Type: application/xml'  -d " <body rid='2965554435' xmlns='http://jabber.o=utf-8' ver='1.6' xmpp:version='1.0' xmpp:xmlns='urn:xmpp:xbosh' /> " https://dashboard.onsip.com/http-bind

what is the difference ? and is the second one is appropriate to write so?

P.S. XHR xml is generated by OXJS library.

+2  A: 

Only:

xmlns:xmpp='urn:xmpp:xbosh'

declares a namespace. The prefix xmlns:... has a predefined meaning in XML With Namespaces, to bind use of the xmpp:... prefix in the document.

This:

xmpp:xmlns='urn:xmpp:xbosh'

is not a namespace declaration, it's an attribute named xmlns with the prefix xmpp. The xmpp prefix is not bound to any namespace in this document because there is no xmlns:xmpp declaration and it is not a predefined prefix.

An XML With Namespaces parser will complain when it gets xmpp:... attributes and there is no namespace declaration for xmpp. This error will be why the web service is giving you no response.

bobince
Thanks, you are correct. Indeed I stumbled the source where message is generated it happen to be a JSJAC library that came with an examples from OXJS, http://github.com/junction/OXJS/blob/master/examples/demo-jsjac/jsjac.js (line 430). I am amazed how one could write that =(. Anyway you helped a lot with assuring me that the second option is indeed a flaw
simple
Erk! Yeah, that's pretty bad. This appears to be fixed upstream in jsjac, see http://github.com/sstrigler/JSJaC/commit/1c4f0b7e3fe7da6276f80227988cf98666278d57
bobince