Partilhar via


Attributes That Control Encoded SOAP Serialization 

The World Wide Web Consortium (www.w3.org) document named "Simple Object Access Protocol (SOAP) 1.1" contains an optional section (section 5) that describes how SOAP parameters can be encoded. To conform to section 5 of the specification, you must use a special set of attributes found in the System.Xml.Serialization namespace. Apply those attributes as appropriate to classes and members of classes, and then use the XmlSerializer to serialize instances of the class or classes.

The following table shows the attributes, where they can be applied, and what they do. For more information about using these attributes to control XML serialization, see How to: Serialize an Object as a SOAP-Encoded XML Stream and How to: Override Encoded SOAP XML Serialization.

For more information about attributes, see Extending Metadata Using Attributes.

Attribute Applies to Specifies

SoapAttributeAttribute

Public field, property, parameter, or return value.

The class member will be serialized as an XML attribute.

SoapElementAttribute

Public field, property, parameter, or return value.

The class will be serialized as an XML element.

SoapEnumAttribute

Public field that is an enumeration identifier.

The element name of an enumeration member.

SoapIgnoreAttribute

Public properties and fields.

The property or field should be ignored when the containing class is serialized.

SoapIncludeAttribute

Public-derived class declarations and public methods for Web Services Description Language (WSDL) documents.

The type should be included when generating schemas (to be recognized when serialized).

SoapTypeAttribute

Public class declarations.

The class should be serialized as an XML type.

See Also

Tasks

How to: Serialize an Object as a SOAP-Encoded XML Stream
How to: Override Encoded SOAP XML Serialization
How to: Serialize an Object
How to: Deserialize an Object

Reference

XmlSerializer

Other Resources

XML and SOAP Serialization
Extending Metadata Using Attributes