XMPP API with Strophe

62 views
Skip to first unread message

Shaun

unread,
Jul 22, 2010, 12:55:51 AM7/22/10
to collecta developer
Hi all,

i'm creating an 'iq' stanza with Strophe.js to be sent to the Collecta
XMPPAPI.
everything works fine, until the script sends the stanza over. i get
the following error:

<body rid='607495811' xmlns='http://jabber.org/protocol/httpbind'
sid='ab59c6e0621fc14f261c13ce501feb9f2d935c0d' type='terminate'>
<presence xmlns='jabber:client' type='unavailable'/>
</body>

looking at my stanza (created by Strophe $ip()), it inserts,
automatically, "xmlns='jabber:client'" into my IQ tag.

<iq type='set' from='to...@collecta.com/search'
to='search.collecta.com' id='notify1' xmlns='jabber:client'>



my question is.. how do i get rid of that bit at the end??
(xmlns='jabber.client')

any ideas?

Christopher Zorn

unread,
Jul 22, 2010, 8:46:08 AM7/22/10
to collecta-...@googlegroups.com
On Thu, Jul 22, 2010 at 12:55 AM, Shaun <sh...@creation.st> wrote:
Hi all,

Hello 
 
i'm creating an 'iq' stanza with Strophe.js to be sent to the Collecta
XMPPAPI.
everything works fine, until the script sends the stanza over. i get
the following error:

<body rid='607495811' xmlns='http://jabber.org/protocol/httpbind'
sid='ab59c6e0621fc14f261c13ce501feb9f2d935c0d' type='terminate'>
<presence xmlns='jabber:client' type='unavailable'/>
</body>
 
looking at my stanza (created by Strophe $ip()), it inserts,
automatically, "xmlns='jabber:client'" into my IQ tag.

<iq type='set' from='to...@collecta.com/search'
to='search.collecta.com' id='notify1' xmlns='jabber:client'>



First, you are sending the iq with a from attribute of to...@collecta.com. It needs to be the current user. This may be triggering the error. 
 

my question is.. how do i get rid of that bit at the end??
(xmlns='jabber.client')

any ideas?

The jabber:client namespace should be used. I dont think its causing your error. Try setting the correct jid in the from attribute for you subscription request and if that doesnt work then a log from your BOSH connection manager should help find the problem. 


Shaun

unread,
Jul 23, 2010, 12:22:10 AM7/23/10
to collecta developer, Christopher Zorn
thank you so much for the clue. yes, i've examined other apps, and
also realise that the jabber:client wasn't the problem.

so this might sound stupid.. but what do I put into the 'FROM'
attribute? where/what is the current user?


Almost there...
Shaun

On Jul 22, 8:46 pm, Christopher Zorn <christop...@gmail.com>
wrote:

Shaun

unread,
Jul 23, 2010, 12:32:40 AM7/23/10
to collecta developer, Christopher Zorn
I still get the following error when i change the FROM attribute to a
proper email address:

<body type='terminate' condition='remote-stream-error' xmlns='http://
jabber.org/protocol/httpbind' xmlns:stream='http://etherx.jabber.org/
streams'><stream:error>
<invalid-from xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
</stream:error>
</body>


any clues? :)
On Jul 22, 8:46 pm, Christopher Zorn <christop...@gmail.com>
wrote:

Kirk Bateman

unread,
Jul 23, 2010, 2:36:42 AM7/23/10
to collecta-...@googlegroups.com
Shaun,

Try leaving the from attribute empty, I think the server should add the jid that is associated with your current connection.

Also do please note that a jid whilst being the same format as an email address it is NOT an actual email address usually, it is just a registered account on an xmpp domain.

Cheers

Kirk

On 23 Jul 2010, at 05:32, Shaun <sh...@creation.st> wrote:

>

Shaun

unread,
Jul 23, 2010, 4:32:50 AM7/23/10
to collecta developer
thanks kirk.

i just tried that (leaving jid blank), but the same error appears.
(Remote-Stream-Error)

i read on the API key request page, that you needed to specify which
API you're going to use.
perhaps this is the problem - my API key is not allowed to access the
XMPP API? anyway, i've written to request a new key, and i've
specified that i want to use the XMPP API. hope this solves it.

Shaun

Mick Thompson

unread,
Jul 23, 2010, 4:58:05 AM7/23/10
to collecta-...@googlegroups.com
Hey Shaun,
 
i just tried that (leaving jid blank), but the same error appears.
(Remote-Stream-Error)

You cant have a blank from attribute either.  You need to either set it to jid that you are logged in as, or not include the attribute all together, then it should work.
 
i read on the API key request page, that you needed to specify which
API you're going to use.
perhaps this is the problem - my API key is not allowed to access the
XMPP API? anyway, i've written to request a new key, and i've
specified that i want to use the XMPP API. hope this solves it.


Even if you only ask for a rest key, access to the xmpp api will be enabled as well.


_Mick

xmpp + email: mi...@collecta.com

Kirk Bateman

unread,
Jul 23, 2010, 5:03:10 AM7/23/10
to collecta-...@googlegroups.com


On 23 Jul 2010, at 09:58, Mick Thompson <mi...@collecta.com> wrote:

Hey Shaun,
 
i just tried that (leaving jid blank), but the same error appears.
(Remote-Stream-Error)

You cant have a blank from attribute either.  You need to either set it to jid that you are logged in as, or not include the attribute all together, then it should work.
 

Apologies, I didn't word my suggestion very well. I did mean to not include the from attribute at all. Probably should have woken up properly before responding :)

Kirk Bateman

unread,
Jul 23, 2010, 5:10:48 AM7/23/10
to collecta-...@googlegroups.com

Shaun,

I just looked back at some past posts on the google groups list and found a post with exactly the same problem, which was resolved by either using the connection.jid as the from attribute or by not including a from at all.

Hope that helps

Original post was October 17 2009 about invalid from attribute :)

Cheers

Kirk

Shaun

unread,
Jul 26, 2010, 1:22:45 AM7/26/10
to collecta developer
YES IT WORKS!!!!!!

thank you all so much. so you're from the future.. and you're
wondering how to solve this problem... :

leave out the 'FROM:' attribute altogether from the <iq> stanza. the
example given in the collecta documentation is slightly misleading.

now, need to figure out how how to detect messages.

Thanks again.

On Jul 23, 5:10 pm, Kirk Bateman <kirk.bate...@gmail.com> wrote:
> Shaun,
>
> I just looked back at some past posts on the google groups list and found a post with exactly the same problem, which was resolved by either using the connection.jid as the from attribute or by not including a from at all.
>
> Hope that helps
>
> Original post was October 17 2009 about invalid from attribute :)
>
> Cheers
>
> Kirk
>
> On 23 Jul 2010, at 10:03, Kirk Bateman <kirk.bate...@gmail.com> wrote:
>
>
>
> > On 23 Jul 2010, at 09:58, Mick Thompson <m...@collecta.com> wrote:
>
> >> Hey Shaun,
>
> >> i just tried that (leaving jid blank), but the same error appears.
> >> (Remote-Stream-Error)
>
> >> You cant have a blank from attribute either.  You need to either set it to jid that you are logged in as, or not include the attribute all together, then it should work.
>
> > Apologies, I didn't word my suggestion very well. I did mean to not include the from attribute at all. Probably should have woken up properly before responding :)
>
> >> i read on the API key request page, that you needed to specify which
> >> API you're going to use.
> >> perhaps this is the problem - my API key is not allowed to access the
> >> XMPP API? anyway, i've written to request a new key, and i've
> >> specified that i want to use the XMPP API. hope this solves it.
>
> >> Even if you only ask for a rest key, access to the xmpp api will be enabled as well.
>
> >> _Mick
>
> >> xmpp + email: m...@collecta.com

Jack Moffitt

unread,
Jul 26, 2010, 4:39:13 PM7/26/10
to collecta-...@googlegroups.com
> leave out the 'FROM:' attribute altogether from the <iq> stanza. the
> example given in the collecta documentation is slightly misleading.

I apologize for the confusion. Stanzas are normally given in examples
with the from so that it's clear who is sending the stanza.

Just remember that you never need to specify the from yourself in the
client case. The server will always stamp the from with your full JID.
Some servers will ignore what you put, but others will reject any
attempt to "forge" a stanza.

I'm glad you've got it working.

jack.

Reply all
Reply to author
Forward
0 new messages