SoapMethodAttribute Class

Indicates that a method is callable across the Internet. This class cannot be inherited.

Namespace: Microsoft.Web.Services2.Messaging
Assembly: Microsoft.Web.Services2 (in microsoft.web.services2.dll)

Usage

'Usage
Dim action As String
Dim soapMethodAttribute1 As New SoapMethodAttribute(action)

Syntax

'Declaration
NotInheritable Public Class SoapMethodAttribute
    Inherits Attribute
public sealed class SoapMethodAttribute : Attribute
public sealed ref class SoapMethodAttribute : public Attribute
public final class SoapMethodAttribute extends Attribute
public class SoapMethodAttribute extends Attribute

Example

The following code example shows how to declare a method with the SoapMethodAttribute.

Class MyService
   Inherits SoapService
   
   <SoapMethod("RequestResponseMethod")>  _
   Public Function RequestResponseMethod(envelope As SoapEnvelope) As SoapEnvelope
      Dim message As String = "Response from " + System.Net.Dns.GetHostName()
      Dim response As New SoapEnvelope()
      response.SetBodyObject(message)
      Return response
   End Function 'RequestResponseMethod
End Class 'MyService
class MyService : SoapService
{
    [SoapMethod("RequestResponseMethod")]
    public SoapEnvelope RequestResponseMethod(SoapEnvelope envelope)
    {
        string message = "Response from " + System.Net.Dns.GetHostName();
        SoapEnvelope response = new SoapEnvelope();
        response.SetBodyObject(message);
        return response;
    }
}

Remarks

The SoapMethodAttribute attribute can be applied only to a method in a class that derives from the SoapService class. One of the method's parameters must be either a SoapEnvelope or an XML serializable type, and the method's return type must be a SoapEnvelope or an XML serializable type. The SoapMethodAttribute allows you to specify the SOAP action for the SOAP operation.

Inheritance Hierarchy

System.Object
  System.Attribute
    Microsoft.Web.Services2.Messaging.SoapMethodAttribute

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.

Platforms

Development Platforms

Windows XP Home Edition, Windows XP Professional, Windows Server 2003, Windows Longhorn, and Windows 2000

Target Platforms

Windows 2000, Windows 2000 Server, Windows 2000 Advanced Server, Windows XP Home Edition, Windows XP Professional, Windows Server 2003, Windows Longhorn, Pocket PC, Windows CE, Smart Phone

See Also

Reference

Microsoft.Web.Services2.Messaging Namespace

Other Resources

SoapMethodAttribute Members