public sealed class SoapFormatter : IRemotingFormatter, IFormatter
|
During RPCs, the IRemotingFormatter interface allows the specification of two separate object graphs: the graph of objects to serialize, and an additional graph containing 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 IMethodCallMessage interface or the IMethodReturnMessage interface.
During deserialization of an RPC, a HeaderHandler delegate is specified to the BinaryFormatter.Deserialize method of the formatter. The remoting infrastructure uses the HeaderHandler delegate to produce an object that supports the ISerializable interface. This object contains the information stored in the headers, and becomes the root of the graph returned by the deserializer.
The SoapFormatter can also handle RPCs that are produced with objects implementing the ISoapMessage interface. To create an RPC without using the IRemotingFormatter functionality, place an object that supports the 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 ISoapMessage interface, and contains the relevant remote call information.
ctor #1 | Overloaded:.ctor() Default constructor. This constructor is called by derived class constructors to initialize state in this type.Initializes a new instance of the SoapFormatter class with default property values. |
ctor #2 | Overloaded:.ctor(ISurrogateSelector selector, StreamingContext context) Initializes a new instance of the SoapFormatter class with the specified ISurrogateSelector and StreamingContext. |
AssemblyFormat | Read-write Gets or sets the format in which assembly names are serialized. |
Binder | Read-write Gets or sets the SerializationBinder that controls the binding of a serialized object to a type. |
Context | Read-write Gets or sets the StreamingContext used with this SoapFormatter. |
SurrogateSelector | Read-write Gets or sets the SurrogateSelector that controls type substitution during serialization and deserialization. |
TopObject | Read-write Gets or sets the ISoapMessage into which the SOAP top object is deserialized. |
TypeFormat | Read-write Gets or sets the format in which type descriptions are laid out in the serialized stream. |
Deserialize | Overloaded:Deserialize(Stream serializationStream) Deserializes the data on the provided stream and reconstitutes the graph of objects. |
Deserialize | Overloaded:Deserialize(Stream serializationStream, HeaderHandler handler) Deserializes the stream into an object graph, with any headers in that stream being handled by the given HeaderHandler. |
Equals (inherited from System.Object) |
See base class member description: System.Object.Equals Derived from System.Object, the primary base class for all objects. |
GetHashCode (inherited from System.Object) |
See base class member description: System.Object.GetHashCode Derived from System.Object, the primary base class for all objects. |
GetType (inherited from System.Object) |
See base class member description: System.Object.GetType Derived from System.Object, the primary base class for all objects. |
Serialize | Overloaded:Serialize(Stream serializationStream, object graph) Serializes an object, or graph of objects with the specified root to the given Stream. |
Serialize | Overloaded:Serialize(Stream serializationStream, object graph, Header[] headers) Serializes an object, or graph of objects with the specified root to the given Stream in the SOAP RPC (Remote Procedure Call) format. |
ToString (inherited from System.Object) |
See base class member description: System.Object.ToString Derived from System.Object, the primary base class for all objects. |
Finalize (inherited from System.Object) |
See base class member description: System.Object.Finalize Derived from System.Object, the primary base class for all objects. |
MemberwiseClone (inherited from System.Object) |
See base class member description: System.Object.MemberwiseClone Derived from System.Object, the primary base class for all objects. |
Hierarchy:
public SoapFormatter(); |
Property | Value |
---|---|
SoapFormatter.SurrogateSelector | null . |
SoapFormatter.Context | A new StreamingContext initialized to specify that the serialized data can be transmitted to or received from any of the other contexts. |
public SoapFormatter( |
selector
context
The serialization or deserialization process uses the specified ISurrogateSelector to search for surrogates that are registered for the object types you want to deserialize. Surrogates are helpers that serialize and deserialize objects of specific classes. The default ISurrogateSelector cannot handle the serialization of objects that derive from the MarshalByRefObject for remoting purposes. In a remoting situation the specified ISurrogateSelector replaces the object derived from MarshalByRefObject with an ObjRef object that is serialized by the specified surrogate selector. Therefore, if you want to use remote objects, set the selector parameter to an instance of RemotingSurrogateSelector. If you do not need surrogates, set the selector parameter to be null.
public FormatterAssemblyStyle AssemblyFormat {get; set;}
|
public SerializationBinder Binder {get; set;}
|
public StreamingContext Context {get; set;}
|
public ISurrogateSelector SurrogateSelector {get; set;}
|
public ISoapMessage TopObject {get; set;}
|
public FormatterTypeStyle TypeFormat {get; set;}
|
serializationStream
Exception Type | Condition |
---|---|
ArgumentNullException | serializationStream is null. |
public object Deserialize( |
serializationStream
handler
Exception Type | Condition |
---|---|
ArgumentNullException | serializationStream is null. |
SerializationException | serializationStream supports seeking, and its length is 0. |
~SoapFormatter(); |
public virtual int GetHashCode(); |
public Type GetType(); |
protected object MemberwiseClone(); |
serializationStream
graph
Exception Type | Condition |
---|---|
ArgumentNullException | serializationStream is null. |
serializationStream
graph
headers
Exception Type | Condition |
---|---|
ArgumentNullException | serializationStream is null. |
public virtual string ToString(); |