Serialization with/out WebService

T

Tamir Khason

Strange thing indeed...
I serialize my object on Client Side and apply it to WS, wich recieved
XMLDocument as Input.
WS saves it and it's possible to retrive the XMLDocument from WS by Client
Side and the Deserialize it. This working fine!
The SAME object with SAME serialization procedure, BUT Serialized on Client
Side and Deserialized on WS failed with "...No Set to the Instance of the
Object..." error. WHY? Very strange, VERY VERY
Sources available upon request.

TNX
 
K

Kevin Yu [MSFT]

Hi Tamir,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you have received an error message when
deserializing an XmlDocument in the WebService. If there is any
misunderstanding, please feel free to let me know.

Based on the information you have provided, it seems that the reference
hasn't been set to a valid XmlDocument object. Could you please paste your
code for serializing at client and deserializing at web service? Please
also paste the complete exception message here, so that we can provide out
assistance more quickly.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
T

Tamir Khason

[WebMethod]

public System.Xml.XmlDocument GetObjects(System.Xml.XmlNode objectData)

{

doc = new System.Xml.XmlDocument();

try

{


doc.AppendChild(doc.ImportNode(objectData,true));


DL.SomeGlobalDataClasses.GlobalObject =

((DL.ObjectSerialized)ser.DeSerialize(doc,typeof(DL.ObjectSerialized))).Glob
alObjects; //Here Exception System.NullReferenceException: Object reference
not set to an instance of an object. Method DeSerialize work fine in other
content









}

catch(Exception e)

{

Console.WriteLine(e.ToString());

}

return doc;

}



Here
 
K

Kevin Yu [MSFT]

Hi Tamir,

From the error message, It seems that some reference might not have been
set to a valid object. For debugging, I have break down the error line into
three lines. Please replace this line with the following lines. If it still
doens't work, please let me know which line throws exception and you can
put the object references in watch window to find out which one was not set
to a valid object and throws the exception.

XmlSerializer ser = new XmlSerializer(typeof(DL.ObjectSerialized));
DL.ObjectSerialized obj = (DL.ObjectSerialized)ser.DeSerialize(doc);
Object o = obj.GlobalObjects;

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top