Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
Obi #1
Member since Nov 2014 · 6 posts
Group memberships: Members
Show profile · Link to this post
Subject: Component Problem
Hi,
I'm trying to send/recieve custom packets as described in tutorial and have a problem on component side.
My component and client connects to server without any problem.
When I send weather packet to the component with Iq, it appears on component side but recieved packet type is not a weather!
I mean (query.GetType() == typeof(Weather)) returns false.
Anybody can help me?

I'm using followings to register weather object on both side.

  1. agsXMPP.Factory.ElementFactory.AddElementType("weather", "agsoftware:weather", typeof(Weather));

Recived xml on component side is

  1. <iq id="agsXMPP_5" type="get" to="weather.development" from="ali@development/e5867c94">
  2.      <query xmlns="agsoftware:weather">
  3.           <zip>74080</zip>
  4.      </query>
  5. </iq>
This post was edited on 2014-11-21, 12:19 by Alex.
Avatar
Alex #2
Member since Feb 2003 · 4295 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
you Factory code is wrong.

Your register:
tagname: weather
namespace: agsoftware:weather

according to your Xml log the tagname is query

so either register tagname as query, or change your weather class you create a weather tag instead of a query tag.

Alex
Avatar
Obi #3
Member since Nov 2014 · 6 posts
Group memberships: Members
Show profile · Link to this post
Thank you very much for your fast reply.
Changing tagname as query solved the problem.
Tutorial can be fixed like this.
Avatar
Obi #4
Member since Nov 2014 · 6 posts
Group memberships: Members
Show profile · Link to this post
I've new problem when send results to client.
I'm getting iq query and sending request with the following code but the client cant get result from component.
I mean OnIq event never called on client side.

  1. iq.SwitchDirection();
  2. iq.Type = IqType.result;
  3. weather.Humidity = new Random().Next(-10, 40);
  4. weather.Temperature = new Random().Next(10, 90);
  5. client.Send(iq);

Recieved xml on component :

  1. <iq id="agsXMPP_5" type="get" to="weather.development" from="ali@development/7a832353">
  2.      <query xmlns="agsoftware:weather">
  3.           <zip>74080</zip>
  4.      </query>
  5. </iq>

Sended xml from component :

  1. <iq xmlns="jabber:component:accept" id="agsXMPP_5" from="weather.development" to="ali@development/7a832353" type="result">
  2.      <query xmlns="agsoftware:weather">
  3.           <zip>74080</zip>
  4.           <humidity>-9</humidity>
  5.           <temperature>11</temperature>
  6.      </query>
  7. </iq>
This post was edited on 2014-11-21, 13:48 by Alex.
Avatar
Alex #5
Member since Feb 2003 · 4295 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Is the client online? Do you send the request to the component after the client marked himself as online?
If yes then you should check the server logs. I see nothing wrong in your xml.

Alex
Avatar
Obi #6
Member since Nov 2014 · 6 posts
Group memberships: Members
Show profile · Link to this post
Sorry it was my mistake.
Thank you for your assistance.
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