Export (0) Print
Expand All

SoapDocumentMethodAttribute.Action Property

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

Namespace:  System.Web.Services.Protocols
Assembly:  System.Web.Services (in System.Web.Services.dll)

public string Action { get; set; }

Property Value

Type: System.String
The SOAPAction HTTP header field of the SOAP request. The default is http://tempuri.org/MethodName, where MethodName is the name of the XML Web service method.

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 on the SOAP specification, see the W3C Web site (http://www.w3.org/TR/SOAP).

The following code example sets the Action property to http://www.contoso.com/GetUserName.

<%@ WebService Language="C#" class="MyUser" %>

 using System.Web.Services;
 using System.Web.Services.Protocols;

 public class MyUser : WebService {

      [ SoapDocumentMethod(Action="http://www.contoso.com/GetUserName")]
      public string GetUserName() {
       return User.Identity.Name;
      }
 }

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft