Subject: Custom IQ packets <service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
I followed the instructions in the documentation that describes creating a custom iq packet.
I get the following error when sending the packet.
Here is the code.
Any ideas?
I get the following error when sending the packet.
- <prime xmlns="primeCRM:packets"><MessageData /><MessageType>Ping</MessageType><FromJabberId>test2@xmpp.prime.web.local/agsXMPP</FromJabberId><ToJabberId>Test1@xmpp.prime.web.local</ToJabberId><AgentId /><ClientInstanceId /><SentDateTime>12/03/2011 11:39:13</SentDateTime></prime><error xmlns="jabber:client" type="cancel" code="503"><service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" /></error>
Here is the code.
Any ideas?
- namespace Prime.Messenger.BaseClientAGS
- {
- using System;
- using System.Globalization;
- using BaseClient;
- using BayTech.Common.Data;
- using agsXMPP.Xml.Dom;
- public class PrimePacket : Element
- {
- public PrimePacket()
- {
- TagName = ConnectionCache.TagName;
- Namespace = ConnectionCache.Namespace;
- }
- public MessageActionType MessageType
- {
- get
- {
- var value = GetTag("MessageType");
- MessageActionType returnValue;
- else
- returnValue = MessageActionType.Unknown;
- return returnValue;
- }
- set { SetTag("MessageType", value.ToString()); }
- }
- public DateTime SentDateTime
- {
- get { return ConvertSafe.ToDateTime(GetTag("SentDateTime")); }
- set { SetTag("SentDateTime", value.ToString(CultureInfo.InvariantCulture)); }
- }
- public DateTime ReceivedDateTime
- {
- get { return ConvertSafe.ToDateTime(GetTag("ReceivedDateTime")); }
- set { SetTag("ReceivedDateTime", value.ToString(CultureInfo.InvariantCulture)); }
- }
- public DateTime ReturnedDateTime
- {
- get { return ConvertSafe.ToDateTime(GetTag("ReturnedDateTime")); }
- set { SetTag("ReturnedDateTime", value.ToString(CultureInfo.InvariantCulture)); }
- }
- public int RoundTripMilliSeconds
- {
- get { return GetTagInt("RoundTripMilliSeconds"); }
- set { SetTag("RoundTripMilliSeconds", value); }
- }
- public string FromJabberId
- {
- get { return GetTag("FromJabberId"); }
- set { SetTag("FromJabberId", value); }
- }
- public string ToJabberId
- {
- get { return GetTag("ToJabberId"); }
- set { SetTag("ToJabberId", value); }
- }
- public Guid? AgentId
- {
- get { return GetTag("AgentId").ToGuid(); }
- set { SetTag("AgentId", value.ToString()); }
- }
- public Guid? ClientInstanceId
- {
- get { return GetTag("ClientInstanceId").ToGuid(); }
- set { SetTag("ClientInstanceId", value.ToString()); }
- }
- public string MessageData
- {
- get { return GetTag("MessageData"); }
- set { SetTag("MessageData", value); }
- }
- // private List<string> _ipAddress;
- // public List<string> IPAddress
- // {
- // get { return _ipAddress; }
- // set { _ipAddress = value; }
- // }
- }
- }
- namespace Prime.Messenger.BaseClientAGS
- {
- using agsXMPP;
- using agsXMPP.protocol.client;
- public class PrimePacketIq : IQ
- {
- public PrimePacketIq()
- {
- base.Query = _primePacket;
- GenerateId();
- }
- public PrimePacketIq(IqType type)
- : this()
- {
- Type = type;
- }
- public PrimePacketIq(IqType type, Jid to)
- : this(type)
- {
- To = to;
- }
- public PrimePacketIq(IqType type, Jid to, Jid from)
- : this(type, to)
- {
- From = from;
- }
- public new PrimePacket Query
- {
- get { return _primePacket; }
- }
- }
- }
- ElementFactory.AddElementType(ConnectionCache.TagName, ConnectionCache.Namespace, typeof(PrimePacket));
- private void _clientConnection_OnIq(object sender, IQ e)
- {
- var iq = e;
- var query = iq.Query;
- if (query != null)
- {
- {
- var primePacket = query as PrimePacket;
- if (iq.Type == IqType.get && primePacket != null)
- {
- iq.SwitchDirection();
- iq.Type = IqType.result;
- primePacket.ReceivedDateTime = DateTime.Now;
- _clientConnection.Send(iq);
- }
- }
- }
- }
BringerOD
Show profile
Link to this post
