Problem with long xml response parsing

Post here all your questions related with SmartFoxServer .Net/Unity3D API

Moderators: Lapo, Bax

User avatar
Real McCoy
Posts: 21
Joined: 06 Dec 2008, 12:01

Problem with long xml response parsing

Postby Real McCoy » 19 Feb 2009, 20:42

Hello!

I gets SFSObject from server with much of hashtable members. Each member object has number of fields. When the client receive server response the problem happens. It looks like follows:

Code: Select all

Problems parsing XML: System.NullReferenceException: Object reference not set to an instance of an object.
   at SmartFoxClientAPI.Util.SFSObjectSerializer.Xml2obj(XmlNode xmlNode, SFSObject ao, Int32 depth)
   at SmartFoxClientAPI.Util.SFSObjectSerializer.Xml2obj(XmlNode xmlNode, SFSObject ao, Int32 depth)
   at SmartFoxClientAPI.Util.SFSObjectSerializer.Xml2obj(XmlNode xmlNode, SFSObject ao, Int32 depth)
   at SmartFoxClientAPI.Util.SFSObjectSerializer.Deserialize(String xmlData)

It occurs when response length is 21500 bytes. The response content looks correct in OnDebugMessage handler output but in SFSObject deserialize procedure throwsexception.

And that's all right when I reduced response by shorten field names.

Is it a bug or may be I am wrong?
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 20 Feb 2009, 07:31

Hi Real NcCoy

Hmmmm - very weird. Could I please have you copy/paste the entire XML message that is received on your client?

Yesterday (getting 1.1 ready) we did fix an issue when sending XML in strings. That would get mangled up (or rather the < > & etc characters would).

But your problem seems to be something else.

So please - copy your received message here, and I can try to run it locally through the deserializer.

Best
Thomas
User avatar
Real McCoy
Posts: 21
Joined: 06 Dec 2008, 12:01

Postby Real McCoy » 20 Feb 2009, 13:15

ThomasLund
Server response has been sent as PM.
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 21 Feb 2009, 13:36

OK - just a quick update.

The issue has been solved by introducing a try/catch around a (seem from the code) invalid XML. The XML is perfectly valid, but doesnt contain anything - and the code threw an exception trying to access the non-existing child node.

The robustness fix has been updated in my development build and works with the XML sent by Real McCoy.

So it was not an issue with length, but content of the given XML.

/Thomas

Return to “.Net / Unity3D API”

Who is online

Users browsing this forum: No registered users and 16 guests