This documentation is archived and is not being maintained.

SoapDocumentMethodAttribute.Action Property

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

[Visual Basic]
Public Property Action As String
[C#]
public string Action {get; set;}
[C++]
public: __property String* get_Action();
public: __property void set_Action(String*);
[JScript]
public function get Action() : String;
public function set Action(String);

Property Value

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.

Remarks

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).

Example

[Visual Basic, C#] The following code example sets the Action property to http://www.contoso.com/GetUserName.

[Visual Basic] 
<%@ WebService Language="VB" class="MyUser" %>

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

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


[C#] 
<%@ 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;
      }
 }

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

Requirements

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

See Also

SoapDocumentMethodAttribute Class | SoapDocumentMethodAttribute Members | System.Web.Services.Protocols Namespace

Show: