System.Runtime.Serialization.Formatters.Soap.SoapFormatter Class

Serializes and deserializes an object, or an entire graph of connected objects, in SOAP format.

See Also: SoapFormatter Members


public sealed class SoapFormatter : System.Runtime.Remoting.Messaging.IRemotingFormatter



Beginning with the .NET Framework 2.0, this class is obsolete. Use System.Runtime.Serialization.Formatters.Binary.BinaryFormatter instead.

The System.Runtime.Serialization.Formatters.Soap.SoapFormatter and System.Runtime.Serialization.Formatters.Binary.BinaryFormatter classes implement the System.Runtime.Remoting.Messaging.IRemotingFormatter interface to support remote procedure calls (RPCs), and the System.Runtime.Serialization.IFormatter interface (inherited by the System.Runtime.Remoting.Messaging.IRemotingFormatter) to support serialization of a graph of objects. The System.Runtime.Serialization.Formatters.Soap.SoapFormatter class also supports RPCs with System.Runtime.Serialization.Formatters.ISoapMessage objects, without using the System.Runtime.Remoting.Messaging.IRemotingFormatter functionality.

During RPCs, the System.Runtime.Remoting.Messaging.IRemotingFormatter interface allows the specification of two separate object graphs: the graph of objects to serialize, and an additional graph that contains an array of header objects that convey information about the remote function call (for example, transaction ID or a method signature). For proper serialization, the root object of the first graph must be an object that implements either the System.Runtime.Remoting.Messaging.IMethodCallMessage interface or the System.Runtime.Remoting.Messaging.IMethodReturnMessage interface.

During deserialization of an RPC, a System.Runtime.Remoting.Messaging.HeaderHandler delegate is specified to the System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(System.IO.Stream) method of the formatter. The remoting infrastructure uses the System.Runtime.Remoting.Messaging.HeaderHandler delegate to produce an object that supports the System.Runtime.Serialization.ISerializable interface. This object contains the information stored in the headers, and becomes the root of the graph returned by the deserializer.

The System.Runtime.Serialization.Formatters.Soap.SoapFormatter can also handle RPCs that are produced with objects that implement the System.Runtime.Serialization.Formatters.ISoapMessage interface. To create an RPC without using the System.Runtime.Remoting.Messaging.IRemotingFormatter functionality, place an object that supports the System.Runtime.Serialization.Formatters.ISoapMessage interface at the root of a graph being serialized. To deserialize an RPC created in this manner the SoapFormatter.TopObject property must be set to another object that supports the System.Runtime.Serialization.Formatters.ISoapMessage interface, and contains the relevant remote call information.

TimeSpan Serialization

TimeSpan objects are serialized according to the ISO 8601: 1998 section "Alternative" standard.

Version Information

The System.Runtime.Serialization.Formatters.Soap.SoapFormatter does not support serialization compatibility between versions of the .NET Framework. Serialization between versions 1.1 and 2.0 types in the Framework often fails. The following actions can be taken to remedy this issue:


Namespace: System.Runtime.Serialization.Formatters.Soap
Assembly: System.Runtime.Serialization.Formatters.Soap (in System.Runtime.Serialization.Formatters.Soap.dll)
Assembly Versions: 1.0.5000.0,