Introducing Serialization in .NET
page 7 of 14
by Joydip Kanjilal
Feedback
Average Rating: 
Views (Total / Last 10 Days): 73612/ 94

SOAP Serialization

The SOAP protocol is ideal for communicating between applications that use heterogeneous architectures.  In order to use SOAP serialization in .NET we have to add a reference to System.Runtime.Serialization.Formatters.Soap in the application.  The basic advantage of SOAP serialization is portability.  The SoapFormatter serializes objects into SOAP messages or parses SOAP messages and extracts serialized objects from the message.  The following code listing shows how we can implement serialization using the SOAP protocol.

Listing 4:

public void SOAPSerialize(string filename,Employee employeeObject)
{
  FileStream fileStreamObject = new FileStream(filename, FileMode.Create);
  SoapFormatter soapFormatter = new SoapFormatter();
  soapFormatter.Serialize(fileStreamObject, employeeObject);
  fileStreamObject.Close();
}

The following code listing shows how we can implement de-serialization using the SOAP protocol.

Listing 5:

public static object SOAPDeserialize(string filename)
{
  FileStream fileStreamObject = new FileStream(filename, FileMode.Open);
  SoapFormatter soapFormatter = new SoapFormatter();
  object obj = (object)soapFormatter.Deserialize(fileStreamObject);
  fileStreamObject.Close();
  return obj;
}

View Entire Article

User Comments

Title: Really Very Good, and easy to understand Article   
Name: Ved Prakash
Date: 2006-12-29 6:24:11 AM
Comment:
Really Very Good, and easy to understand Article
Title: EASY TO UNDERSTAND   
Name: RESHMA
Date: 2006-12-27 7:30:09 AM
Comment:
EASY TO UNDERSTAND THE DIFFERENCES BETWEEN DIIF TYPE OF SERIALIZATIONS.
Title: Good Article   
Name: santosh
Date: 2006-12-08 1:50:03 AM
Comment:
Very nice one for those who doen't have much idea about serilazation. Basiaclly it is giving fair introduction.
Title: Good. Need Help   
Name: Nandhini.S
Date: 2006-11-10 6:21:53 AM
Comment:
Hi
This is very good for the starters to begin serialization. But im having doubt in Hoe to store a comple Windows ,Form object in XML document to reconstruct later.
Title: Fabulous! Good job   
Name: Mohammed Abrar
Date: 2006-11-07 2:07:16 AM
Comment:
This is a fantastic article about Serialization.
Special thanks to the author Joydip Kanjilal
Title: Excellent!   
Name: Peter Royle
Date: 2006-10-17 5:51:07 AM
Comment:
The best article I've seen for someone who knows nothing about serialisation (sic).
Title: Great Yaar   
Name: Rangarajan
Date: 2006-10-11 7:28:52 AM
Comment:
Great explanation.. Simple and subtle, understandable and staright forward..
Title: Thank you for your contribution!   
Name: Mamiow
Date: 2006-10-11 12:30:50 AM
Comment:
Very good and understanding article.
Title: best of one   
Name: Mukesh
Date: 2006-10-09 11:24:54 AM
Comment:
Very nice article....

Thanks
Title: What about Performance   
Name: Satyadev Singh
Date: 2006-10-09 3:22:28 AM
Comment:
Hi, This is really a excellent article, however I have some concern regarding the CPU performance when we are going to use SOAP formatter, because in my previous project I used Binary formatter and got CPU uses increased.
That's why I am scared about the CPU performance because in that particuler apps will have 1 hit per second.

You can reach me at singhsatyadev[*at*]gmail[#dot#]com


Thanks,
Title: Nice Article   
Name: ArunKumar P
Date: 2006-10-09 3:02:15 AM
Comment:
It is useful for Beginner's
Title: GIS Architect   
Name: Naren Ranganathan
Date: 2006-10-07 6:48:58 PM
Comment:
Great article on Serialization for newbies.
Title: Diff bet SOAP Formatter & Binary Formatter & XML Formatter   
Name: Jitendra C
Date: 2006-10-03 7:27:51 AM
Comment:
Great!It gives a broad picture of Serialization.I wanted to know more on Difference between SOAP Formatter & Binary Formatter & XML Formatter
Title: need details   
Name: Haroon
Date: 2006-09-29 1:46:27 AM
Comment:
this article is good. but what if we want to know that which .net types (e.g SQL types for .net like SQLBoolean and e.t.c.., that are not serializable) are serializable.
I would appreciate if you can provide list of the types that are not serializable in .net
Title: Good for starters   
Name: Sandeep Gulati
Date: 2006-09-25 1:55:25 PM
Comment:
A good articles for starters.
Title: gr8 article   
Name: abhi_viking
Date: 2006-09-25 7:29:02 AM
Comment:
really useful 1
Title: Very useful   
Name: BT
Date: 2006-09-23 11:29:27 PM
Comment:
Very nice article but I'm still left to wonder which of the serilization methods described above is the best one to use (most widely used in the field).
Title: Simple but most Effective   
Name: Mazher Yasin
Date: 2006-09-21 2:15:44 AM
Comment:
Greate Effort
Title: Superb   
Name: Amin
Date: 2006-09-13 2:58:59 PM
Comment:
10 out of 10
Title: Very Good Introduction   
Name: Bharat Sisodiya
Date: 2006-09-12 8:20:29 AM
Comment:
Very good Information for Starters
Title: Great Article   
Name: Michelle
Date: 2006-09-06 3:53:20 PM
Comment:
Great article - good information!






Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-03-28 6:42:39 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search