SoapDocumentMethodAttribute.Action プロパティ

定義

SOAP 要求の SOAPAction HTTP ヘッダー フィールドを取得または設定します。

public:
 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

プロパティ値

SOAP 要求の SOAPAction HTTP ヘッダー フィールド。 既定値は です http://tempuri.org/MethodName。ここで、MethodName は XML Web サービス メソッドの名前です。

次のコード例では、 プロパティを Actionhttp://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;
      }
 }
<%@ 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

注釈

通常、 Action プロパティは要求の意図を示す URI です。 ただし、SOAP 仕様では、URI の形式や URI が解決可能かどうかに関する規則に制限はありません。 プロパティの Action 存在とコンテンツは、ファイアウォールなどの Web サーバーが HTTP で SOAP 要求メッセージを適切にフィルター処理するために使用できます。

既定では、.NET Framework バージョン 1.1 では、XML Web サービス用に生成された WSDL ドキュメントでsoapActionサポートされている SOAP バインドごとに、 要素の 属性soap:operationの プロパティが発行Actionされます。 詳細については、W3C Web サイトの SOAP 仕様を参照してください。

適用対象