Home > WCF > WCF # 18–WCF Serialization Vs Encoding [XML Information Set,Difference between XML infoset and XML]

WCF # 18–WCF Serialization Vs Encoding [XML Information Set,Difference between XML infoset and XML]

Hi Friends,

Today we will start with very interesting feature of WCF called Serialization and Encoding.

We use serialization for transmission of messages in between client and server we need to convert CLR types to standards-based XML.

Encoding is the conversion of WCF message in to the byte array.

Serialization Vs. Encoding

There are important differences between serialization and encoding in WCF.

1) Serialization

-> It is the term often used to describe the process of converting an object graph into an array of bytes.

-> This is a very useful feature for representing the state of an object. Serialization can be used to persist an object’s state to a file or a database, copy an object to the clipboard, or transfer objects across a network to another application. WCF does not follow the standard definition of serialization, though.

-> WCF defines serialization as the process of converting an object graph into an XML Information Set (XML Infoset)

  i) The XML Infoset is the data model WCF uses internally to represent a message.

  ii) The XML Infoset is the data model for representing an XML document.

Difference between XML and XML Infoset

-> XML use only standard text format.XML Infoset doesnt have such restrictions.

For Example

WCF can represent messages in different formats as long as they are based on an XML Infoset. This includes the text format specified by the XML1.1 specification as well as other formats such as a binary XML format.

 

2) Encoding

-> It is the term used to describe the process of converting a WCF message into an array of bytes. This is done so that the message can be sent across a transport protocol.

->WCF provides five types of encoding formats: binary, text, Message Transmission Optimization Mechanism (MTOM), JavaScript Object Notation, and Plain-Old-XML (POX). Which one you use will depend on your application’s requirements

-> For example, you may want to use the BinaryMessageEncoder for optimal performance between .NET applications, use the TextMessageEncoder for interoperability based on WS-* Web services, or use the JSONMessageEncoder  for AJAX-based Web applications.

 

In our coming posts we look at how WCF uses serialization and encoding to transmit messages across a transport. We will examine the different forms of serialization and encoding and present scenarios where each option should be used..

Thanks.

About these ads
Categories: WCF
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 221 other followers

%d bloggers like this: