Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
ayyrk #1
Member since Jul 2007 · 92 posts
Group memberships: Members, Premium
Show profile · Link to this post
Subject: Creating your own packet types
I tried the instructions in the "Creating your own packet types" pdf on the download page. The two JIDs have subscription type "both".  I get the 503 response.

Thank you for any suggestions - I am still tyring to figure this out.

Thanks!


------------[ Sent 08:41:14 ]------------
<iq xmlns="jabber:client" id="agsXMPP_5" type="get" to="foorpcd@sandbenderxpvm" from="pcdone@sandbenderxpvm
"><query xmlns="agsoftware:weather"><zip>90210</zip></query></iq>

------------[ Received 08:41:14 ]------------
<iq xmlns="jabber:client" from="foorpcd@sandbenderxpvm" to="pcdone@sandbenderxpvm/pcdClient" type="error" i
d="agsXMPP_5"><query xmlns="agsoftware:weather"><zip>90210</zip></query><error code="503" type="cancel"><ser
vice-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" /></error></iq>
Avatar
ayyrk #2
Member since Jul 2007 · 92 posts
Group memberships: Members, Premium
Show profile · Link to this post
Is the "weather service" supposed to be a Component?

I am using a client connection for both the "romeo client" and the "weather service".  Maybe that's my problem.
Avatar
ayyrk #3
Member since Jul 2007 · 92 posts
Group memberships: Members, Premium
Show profile · Link to this post
In reply to post #1
This is where I'm stuck on the "weather service" side - query.GetType is returning agsXMPP.Xml.Dom.Element.



if (query.GetType() == typeof(Weather))
Avatar
Alex #4
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by ayyrk:
This is where I'm stuck on the "weather service" side - query.GetType is returning agsXMPP.Xml.Dom.Element.



if (query.GetType() == typeof(Weather))

then you did not add the custom type to teh ELemen tFactory.

Alex
Avatar
Alex #5
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
In reply to post #2
Quote by ayyrk:
Is the "weather service" supposed to be a Component?

I am using a client connection for both the "romeo client" and the "weather service".  Maybe that's my problem.
no, you can use this code for clients, server and components.

Alex
Avatar
Alex #6
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
In reply to post #1
Quote by ayyrk:
I tried the instructions in the "Creating your own packet types" pdf on the download page. The two JIDs have subscription type "both".  I get the 503 response.

Thank you for any suggestions - I am still tyring to figure this out.

Thanks!


------------[ Sent 08:41:14 ]------------
<iq xmlns="jabber:client" id="agsXMPP_5" type="get" to="foorpcd@sandbenderxpvm" from="pcdone@sandbenderxpvm
"><query xmlns="agsoftware:weather"><zip>90210</zip></query></iq>

------------[ Received 08:41:14 ]------------
<iq xmlns="jabber:client" from="foorpcd@sandbenderxpvm" to="pcdone@sandbenderxpvm/pcdClient" type="error" i
d="agsXMPP_5"><query xmlns="agsoftware:weather"><zip>90210</zip></query><error code="503" type="cancel"><ser
vice-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" /></error></iq>
You send the stanza to a bare Jid.
You have to send Iq'S always to a full Jid (user@server/resource).

Alex
Avatar
ayyrk #7
Member since Jul 2007 · 92 posts
Group memberships: Members, Premium
Show profile · Link to this post
1) Is there any relationship between the namespace parameter in AddElementType and the object's C# namespace?

2) In the .pdf example it sends   to='weather.mortagne.net'    is that correct as you said above it should include the resource.

Thanks - I think I'm close to getting this simple example going.
Avatar
Alex #8
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Yes there is a mapping from namespaces + tagname to the c# objects. Please study the ElementFactory in the source for that.
If no mapping is found in the factory a agsXMPP.Xml.Dom.Element instance will be created.

The example sends it to a component, there its OK without resource. But i think you send it from client to client which means you need a resource.

Alex
Avatar
ayyrk #9
Member since Jul 2007 · 92 posts
Group memberships: Members, Premium
Show profile · Link to this post
I got the "Weather Service" example from the "Creating your own packet types" .pdf working.

The service uses a component connection. The client uses a client connection.


It started working when I used "query" as the tag name in the following line:
agsXMPP.Factory.ElementFactory.AddElementType("query", "agsoftware:weather", typeof(Weather));

The line in the .pdf reads:
agsXMPP.Factory.ElementFactory.AddElementType("weather", "agsoftware:weather", typeof(Weather));

Question: Is my solution correct?
Avatar
Alex #10
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Yes this is correct. There is a copy&paste big in the PDF. I will fix it.

Alex
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: agsXMPP RSS