Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

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.

System.Object
   System.Attribute
      System.Runtime.Remoting.Metadata.SoapAttribute
         System.Runtime.Remoting.Metadata.SoapTypeAttribute

[Visual Basic]
<AttributeUsage(AttributeTargets.Class Or AttributeTargets.Struct _
   Or AttributeTargets.Enum Or AttributeTargets.Interface)>
NotInheritable Public Class SoapTypeAttribute
   Inherits SoapAttribute
[C#]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct |
   AttributeTargets.Enum | AttributeTargets.Interface)]
public sealed class SoapTypeAttribute : SoapAttribute
[C++]
[AttributeUsage(AttributeTargets::Class | AttributeTargets::Struct
   | AttributeTargets::Enum | AttributeTargets::Interface)]
public __gc __sealed class SoapTypeAttribute : public
   SoapAttribute
[JScript]
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.

Remarks

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.

Example

[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

[C#] 
[Serializable()] 
[SoapTypeAttribute(XmlNamespace="MyXmlNamespace")]
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!";
    }
}

[C++] 
[Serializable] 
[SoapTypeAttribute(XmlNamespace=S"MyXmlNamespace")]
public __gc class TestSimpleObject 
{
public:
    int member1;

    [SoapFieldAttribute(XmlElementName=S"MyXmlElement")]
    String* member2;

    String* member3;
    double member4;

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

public:
    TestSimpleObject() 
    {
        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.

Requirements

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

Show:
© 2015 Microsoft