SoapDocumentMethodAttribute.Action Property


Gets or sets the SOAPAction HTTP header field of the SOAP request.

 property System::String ^ Action { System::String ^ get(); void set(System::String ^ value); };
public string Action { get; set; }
member this.Action : string with get, set
Public Property Action As String

Property Value

The SOAPAction HTTP header field of the SOAP request. The default is, where MethodName is the name of the XML Web service method.


The following code example sets the Action property to

<%@ WebService Language="C#" class="MyUser" %>
 using System.Web.Services;
 using System.Web.Services.Protocols;
 public class MyUser : WebService {
      [ SoapDocumentMethod(Action="")]
      public string GetUserName() {
       return User.Identity.Name;
<%@ WebService Language="VB" class="MyUser" %>

Imports System.Web.Services
Imports System.Web.Services.Protocols

Public Class MyUser
    Inherits WebService
    <SoapDocumentMethod(Action := "")> _
    Public Function _
        GetUserName() As String
        Return User.Identity.Name
    End Function
End Class


Typically, the Action property is a URI indicating the intent of the request. However, the SOAP specification places no restrictions on the format of the URI, or any rules about whether the URI is resolvable. The presence and content of the Action property can be used by Web servers, such as firewalls, to appropriately filter SOAP request messages in HTTP.

By default, the .NET Framework version 1.1 publishes the Action property in the soapAction attribute of the soap:operation element for each supported SOAP binding in WSDL documents generated for an XML Web service. For more information, see the SOAP specification on the W3C website.

Applies to