473,387 Members | 1,700 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,387 software developers and data experts.

serialization, deserialization and serialization again?

In my ws I have a method that serializes a simple custom object with some
properties. On the other side, in my aspx application, the object is
received and deserialized nicely by .net.

But the problem is that i don't _want_ .net to deserialize the returning
xml. The serialized xml text is exactly what I want because Im only going to
feed that string into a simple "Xml Web Control" and then attach a
stylesheet file to it. Im a bit new to this but shouldnt this be very very
simple? At the moment Im doing a work-around and serializing the stupid
object _back_ to xml again and something tells me I shouldnt need to do
that? Since its allready there in the soap response i mean ... but thow do I
get hold of it in aspx .net?

Continuing ...

My first approach was to try and make use of the deserialized object instead
somehow but unfortunately the deserialized object didnt actually have
exactly the same structure as my original object. The properties (get/set)
in my original object had been exchanged for simple variables which then
didnt allow me to use this object as a datasource etc. So that approach left
me with nothing. I really dont get this, why serialize and deserialize if
whats left isnt the same as the original anyway?
Nov 21 '05 #1
2 1170
You could serialize your custom class instance to XML inside your web method
on the server using XmlSerializer and then pass it to the caller as a string
(instead of as an instance of your custom class).
Nov 21 '05 #2
This idea will work, however you will inflate your payload by escaping all
the angle brackets etc.

Another approach is to define the interface as passing an xsd:any, if you
start with WSDL/XSD, or decorating one part of the response message with
[XmlAny], if you start with ASMX. On the receiving (caller) side, you will
get back an instance of XmlElement. At this point you can directly get the
Xml from the XmlElement without going through an XmlSerializer.

For more on this technique check out this article:
http://msdn.microsoft.com/library/en...ce04162003.asp

or google around for XmlAnyElement

-Dino

"richlm" <ri*****@h0tmai1.com> wrote in message
news:O5**************@TK2MSFTNGP12.phx.gbl...
You could serialize your custom class instance to XML inside your web
method on the server using XmlSerializer and then pass it to the caller as
a string (instead of as an instance of your custom class).

Nov 21 '05 #3

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

Similar topics

2
by: Snowman | last post by:
Suppose I have a RootObject which holds a collection of other objects. The other objects have a property (Parent) which refers back to the "parent" collection (b.t.w. my collection is based on...
4
by: Jeff T. | last post by:
Hello, I have an existing set of C# classes that encapsulate our application data. They are in a heirachy with each subclass defining more specific types of data. I would like to serialize these...
1
by: Maheal | last post by:
I have been trying to Serialize an object that is the child of another object which is also serializable. Here is the simplified scenario (assume missing code is correct): class One :...
8
by: Dennis C. Drumm | last post by:
I have a class derived from a SortedList called SystemList that contains a list of objects indexed with a string value. The definition of the objects contained in the SortedList have a boolean...
3
by: Amadelle | last post by:
Hi all and thanks in advance for your help, I am having problems deserializing an object which seems to be serializing just fine. I save the byte array of the serialized object in the database...
2
by: Luck | last post by:
Hi, I really need some expert help... please! Basically, I need to serialize a data structure object to a file using SOAP and then load and de-serialize that file in ANOTHER program. When I...
2
by: andreas | last post by:
Hi, if have a object arrSdList of type SortedList for serialization and deserialization there are two subs for doing this Public Sub deser Dim Formatter As BinaryFormatter = New...
0
by: Goethals Frederik | last post by:
Hi, I have some questions that are a little difficult to explain, so I give it a try... I have an application (aSP.NET with VB.NET codebehind) and I would like to store my data on disk...
5
by: Hans-Jürgen Philippi | last post by:
Hi Group, I've defined a class with an 'ID' property, which is a GUID that is created at the time of the very first object instance creation. This member is not included when I serialize an...
5
by: Harold Howe | last post by:
I am having a problem deserializing objects from a library when the following conditions exist: 1- The library is strongly named 2- The serialized file was created with version 1.0 of the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.