473,396 Members | 2,129 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.

XmlSerializer vs SoapFormatter

Hello,
what is the internal difference between them in FW 2.0?
I'm trying to serialize SqlConnectionInfo from SQL SMO and Soap works just
fine but XML throws an exception

SqlConnectionInfo has SerializableAttribute attribute ????


Nov 21 '05 #1
4 10150
lapas,

The two are incredibly different. Internally, they are separate
programs. You should be more worried about what they do.

XML Serialization will "serialize" (I put it in quotes because it is not
truly serialization, it won't always give you an object that has the same
exact internal state as the one that you serialized) just the public
properties of an object.

Using serialization with the SOAP formatter will actually take the field
values of an object (through reflection) and store all of that information
in the stream passed to you.

Depending on what you are doing, one will be more appropriate than the
other. The XML Serializer is used typically for serializing simple types
across web services, or sending the serialized type to other applications
that won't understand the output that the SOAP or binary formatters will
produce.

Using a proper formatter for serialization should be used in other
scenarios, like when talking to other .NET applications.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"laplas" <la****@discussions.microsoft.com> wrote in message
news:E4**********************************@microsof t.com...
Hello,
what is the internal difference between them in FW 2.0?
I'm trying to serialize SqlConnectionInfo from SQL SMO and Soap works
just
fine but XML throws an exception

SqlConnectionInfo has SerializableAttribute attribute ????

Nov 21 '05 #2
Thank you.
Let me ask you this:
if class has attribute [SerializableAttribute] does it mean that objects of
this class can be serialized by either of XmlSerializer or SoapFormatter?

"Nicholas Paldino [.NET/C# MVP]" wrote:
lapas,

The two are incredibly different. Internally, they are separate
programs. You should be more worried about what they do.

XML Serialization will "serialize" (I put it in quotes because it is not
truly serialization, it won't always give you an object that has the same
exact internal state as the one that you serialized) just the public
properties of an object.

Using serialization with the SOAP formatter will actually take the field
values of an object (through reflection) and store all of that information
in the stream passed to you.

Depending on what you are doing, one will be more appropriate than the
other. The XML Serializer is used typically for serializing simple types
across web services, or sending the serialized type to other applications
that won't understand the output that the SOAP or binary formatters will
produce.

Using a proper formatter for serialization should be used in other
scenarios, like when talking to other .NET applications.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"laplas" <la****@discussions.microsoft.com> wrote in message
news:E4**********************************@microsof t.com...
Hello,
what is the internal difference between them in FW 2.0?
I'm trying to serialize SqlConnectionInfo from SQL SMO and Soap works
just
fine but XML throws an exception

SqlConnectionInfo has SerializableAttribute attribute ????


Nov 21 '05 #3
lapas,

If a class has the serializable attribute on it, then it means that you
can use any class that implements the IFormatter interface to serialize your
class (this means the SOAP formatter and the binary formatter, or any other
formatter, for that matter).

You can attempt to serialize any instance of any class with the XML
Serializer, but the result is not guaranteed to give you an instance with
the same state when deserialized.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"laplas" <la****@discussions.microsoft.com> wrote in message
news:2B**********************************@microsof t.com...
Thank you.
Let me ask you this:
if class has attribute [SerializableAttribute] does it mean that objects
of
this class can be serialized by either of XmlSerializer or SoapFormatter?

"Nicholas Paldino [.NET/C# MVP]" wrote:
lapas,

The two are incredibly different. Internally, they are separate
programs. You should be more worried about what they do.

XML Serialization will "serialize" (I put it in quotes because it is
not
truly serialization, it won't always give you an object that has the same
exact internal state as the one that you serialized) just the public
properties of an object.

Using serialization with the SOAP formatter will actually take the
field
values of an object (through reflection) and store all of that
information
in the stream passed to you.

Depending on what you are doing, one will be more appropriate than
the
other. The XML Serializer is used typically for serializing simple types
across web services, or sending the serialized type to other applications
that won't understand the output that the SOAP or binary formatters will
produce.

Using a proper formatter for serialization should be used in other
scenarios, like when talking to other .NET applications.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"laplas" <la****@discussions.microsoft.com> wrote in message
news:E4**********************************@microsof t.com...
> Hello,
> what is the internal difference between them in FW 2.0?
> I'm trying to serialize SqlConnectionInfo from SQL SMO and Soap works
> just
> fine but XML throws an exception
>
> SqlConnectionInfo has SerializableAttribute attribute ????
>
>
>
>


Nov 21 '05 #4
If a class has the serializable attribute, it means you can use only
standard serialization. XmlSerializer dosn't take it in account, it
works in a different way.

Nicholas Paldino [.NET/C# MVP] wrote:
lapas,

If a class has the serializable attribute on it, then it means that you
can use any class that implements the IFormatter interface to serialize your
class (this means the SOAP formatter and the binary formatter, or any other
formatter, for that matter).

You can attempt to serialize any instance of any class with the XML
Serializer, but the result is not guaranteed to give you an instance with
the same state when deserialized.

Nov 23 '05 #5

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

Similar topics

4
by: Steve C. | last post by:
Is there a way to utilize the IDeserializationCallback interface with the standard XmlSerializer? It does not appear to be supported in this context. IDeserializationCallback works fine when...
2
by: Jarda | last post by:
Hi all, i'm looking for some performance comparison some charts. I have read the xmlserializer is better, more flexible and faster (analyzing data types in constructor), but there are some...
4
by: Steve Long | last post by:
Hello, I hope this is the right group to post this to. I'm trying to serialize a class I've written and I'd like to be able to serialze to both binary and xml formats. Binary serialization is...
0
by: cmrchs | last post by:
Hi, XmlSerializer can serialize data to a file, but SoapFormatter can do the same except that the serialized data in the file is not proper Xml : for instance there is no XmlRoot-element. Why...
2
by: Paul | last post by:
We currently persist our objects to xml/soap files using a SoapFormatter. We control the serialization and de-serialization by implementing the ISerializable and its two interface methods, namely,...
1
by: Paul | last post by:
Can I control XmlSerializer's serialization/deserialization process by implementing ISerializable on the class I'm serializing? I'm doing exactly this with the SoapFormatter and I was wondering if...
1
by: Jim S | last post by:
I have an application where I have to make a tree of objects. To do this, I have my own node class. At certain points in the application, I need to save data. I am having a problem with the...
2
by: Phillip Galey | last post by:
I have an object called Place which contains only string properties and has the <Serializable()> flag before the class name declaration. I also have a collection object called Places, which is...
5
by: =?Utf-8?B?TWFydHluIEZld3RyZWxs?= | last post by:
Hi there. I posted an earlier issue under the name "That assembly does not allow partially trusted callers" but have now identified what the issue is. As explained before I am working in...
0
by: theonlydavewilliams | last post by:
Hi there I'm hoping there's an easy answer to a (hopefully) not too long-winded issue... I'm building a C# web client using a proxy wsdl.exe'd from a wsdl file and six schemas, each in a different...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.