This documentation is archived and is not being maintained.

SoapTypeAttribute Class

Customizes SOAP generation and processing for target types. This class cannot be inherited.

For a list of all members of this type, see SoapTypeAttribute Members.


[Visual Basic]
<AttributeUsage(AttributeTargets.Class Or AttributeTargets.Struct _
   Or AttributeTargets.Enum Or AttributeTargets.Interface)>
NotInheritable Public Class SoapTypeAttribute
   Inherits SoapAttribute
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct |
   AttributeTargets.Enum | AttributeTargets.Interface)]
public sealed class SoapTypeAttribute : SoapAttribute
[AttributeUsage(AttributeTargets::Class | AttributeTargets::Struct
   | AttributeTargets::Enum | AttributeTargets::Interface)]
public __gc __sealed class SoapTypeAttribute : public
   AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct |
   AttributeTargets.Enum | AttributeTargets.Interface)
class SoapTypeAttribute extends SoapAttribute

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.


The SoapTypeAttribute attribute is a custom attribute that can be applied to objects, value types, and interface objects. This attribute is used to specify information on an object type that controls how SOAP will generate the SOAP XML wire format.


[Visual Basic, C#, C++] The following code example demonstrates customization of SOAP generated for a class with the SoapTypeAttribute. The SOAP can be produced by the code shown in the SerializableAttribute class example.

[Visual Basic] 
<Serializable(), SoapTypeAttribute(XmlNamespace := "MyXmlNamespace")> Public Class TestSimpleObject
   Public member1 As Integer

   <SoapFieldAttribute(XmlElementName := "MyXmlElement")> Public member2 As String
   Public member3 As String
   Public member4 As Double

   ' A field that is not serialized.
   <NonSerialized()> Public member5 As String  

   Public Sub New()
      member1 = 11
      member2 = "hello"
      member3 = "hello"
      member4 = 3.14159265
      member5 = "hello world!"
   End Sub 'New

End Class 'TestSimpleObject

public class TestSimpleObject  {

    public int member1;

    [SoapFieldAttribute(XmlElementName="MyXmlElement")] public string member2;

    public string member3;
    public double member4;

    // A field that is not serialized.
    [NonSerialized()] public string member5; 
    public TestSimpleObject() {

        member1 = 11;
        member2 = "hello";
        member3 = "hello";
        member4 = 3.14159265;
        member5 = "hello world!";

public __gc class TestSimpleObject 
    int member1;

    String* member2;

    String* member3;
    double member4;

    // A field that is not serialized.
    String* member5; 

        member1 = 11;
        member2 = S"hello";
        member3 = S"hello";
        member4 = 3.14159265;
        member5 = S"hello world!";

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.


Namespace: System.Runtime.Remoting.Metadata

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: Mscorlib (in Mscorlib.dll)

See Also

SoapTypeAttribute Members | System.Runtime.Remoting.Metadata Namespace