472,331 Members | 1,633 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,331 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 10075
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...
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...
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...
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 :...
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...
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...
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...
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...
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...
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...
0
by: tammygombez | last post by:
Hey fellow JavaFX developers, I'm currently working on a project that involves using a ComboBox in JavaFX, and I've run into a bit of an issue....
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...

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.