473,396 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Trying to Deserialized from a String variable holding the SOAP representation.

I have an object that I want to serialize to a string variable. I
want to use the SoapFormatter, for readability.

The serialization is working great and I'm pleased with the results.
DeSerialization, however, is giving me an error that "The root element
is missing." This happens even when I pass the return value from
Serialize() directly back to the Deserialize() method.

============ Code Snippet ===============
'Seems to work great.
Public Function Serialize() As String
Dim ms As New MemoryStream
Dim sf As New SoapFormatter
Dim ui As New System.Text.ASCIIEncoding
Dim sw As New StringWriter
sf.Serialize(ms, Me)
sw.Write(ui.GetChars(ms.GetBuffer))
Return sw.ToString
End Function

'Fails with the exception: "The root element is missing."
Public Shared Function Deserialize(ByVal SerializedString As
String) As People
Dim lcDeserialize As People
Try
Dim ms As New MemoryStream
Dim sf As New SoapFormatter
Dim sr As New StreamWriter(ms, System.Text.Encoding.ASCII)

sr.Write(SerializedString)
lcDeserialize = CType(sf.Deserialize(ms), People)
Catch ex As Exception
lcDeserialize = New People
End Try
Return lcDeserialize
End Function
=======================================

I have looked on many sites and in MSDN and there are thousands of
examples of persisting an object Serialization to a file and
Deserializing from there, but I could find no examples of using a
String variable holding the Soap XML.

Thanks.

-Jason

-Kevin Buchan
ke**********@REMOVETHISTOEMAILtroutmansanders.com
Nov 20 '05 #1
0 912

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: higabe | last post by:
Three questions 1) I have a string function that works perfectly but according to W3C.org web site is syntactically flawed because it contains the characters </ in sequence. So how am I...
19
by: Mike Tyka | last post by:
Hello community, i'm fairly new to using the STL but i've been experimenting a bit with it. I tried to derive a new class say MyString from string like so: class MyString: public string{...
1
by: The Grand Admiral | last post by:
Question. I have a wsdl soap request structure as follows: <soap:Envelope xmlns:xsi="..." xmlns:xsd="..." xmlns:soap="..."> <soap:Header>... </soap:Header> <soap:Body> <SaveItem xmlns="...">...
0
by: tbrierly | last post by:
Hello, I'm looking for help trying to get the contents of the XML document while in the ValidationEventHandler for XmlReaderSettings. Here is what I mean: We need to be able to validate the...
1
by: wgilreath | last post by:
Announcing a Preview of XString, an XML technology - XML as a String. I've created a means to efficiently encode XML as a flat string, which I term XString. I've written a paper, put some...
2
by: =?Utf-8?B?RmFicmljaW8gRmVycmVpcmE=?= | last post by:
Hi, I'm facing an odd problem when consuming some web services in .Net. After call a web method, the response SOAP envelope isn't being deserialized properly. In fact, all href tags are not...
1
by: vanajasethu | last post by:
Hi all, I am working in dotnet remoting using dotnet framework 2.0 in windows xp. I am hosting the remote object in iis using http channel and binary formatter and registering the object in...
0
by: Smokey Grindel | last post by:
I serialized an object perfectly fine to SOAP and have it stored in a database as a string (sql server 2005 in a XML data type field) now I am pulling that value back and want to de-serialize it...
2
by: monsalvo | last post by:
What's so wrong with my code? This line is part of a VBScript soap client part of a DTS wich is functional in a 90 percent. strText = .responseXML.selectSingleNode("//" login "loginReturn") ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.