次の方法で共有


SoapServices.GetSoapActionFromMethodBase(MethodBase) メソッド

定義

特定の MethodBase で指定したメソッドと関連付けられた SOAPAction 値を返します。

public:
 static System::String ^ GetSoapActionFromMethodBase(System::Reflection::MethodBase ^ mb);
public static string GetSoapActionFromMethodBase (System.Reflection.MethodBase mb);
[System.Security.SecurityCritical]
public static string GetSoapActionFromMethodBase (System.Reflection.MethodBase mb);
static member GetSoapActionFromMethodBase : System.Reflection.MethodBase -> string
[<System.Security.SecurityCritical>]
static member GetSoapActionFromMethodBase : System.Reflection.MethodBase -> string
Public Shared Function GetSoapActionFromMethodBase (mb As MethodBase) As String

パラメーター

mb
MethodBase

SOAPAction を要求したメソッドを格納している MethodBase

戻り値

特定の MethodBase で指定したメソッドと関連付けられた SOAPAction 値。

属性

例外

直前の呼び出し元に、インフラストラクチャ アクセス許可がありません。

このメソッドを使用する方法を次のコード例に示します。 このコード例は、SoapServices クラスのために提供されている大規模な例の一部です。

// Get the SOAP action for the method.
System::Reflection::MethodBase^ getHelloMethodBase =
   ExampleNamespace::ExampleClass::typeid->GetMethod( L"GetHello" );
String^ getHelloSoapAction =
   SoapServices::GetSoapActionFromMethodBase( getHelloMethodBase );
Console::WriteLine( L"The SOAP action for the method "
L"ExampleClass.GetHello is {0}.", getHelloSoapAction );
bool isSoapActionValid =
   SoapServices::IsSoapActionValidForMethodBase(
      getHelloSoapAction, getHelloMethodBase );
if ( isSoapActionValid )
{
   Console::WriteLine( L"The SOAP action, {0}, "
   L"is valid for ExampleClass.GetHello", getHelloSoapAction );
}
else
{
   Console::WriteLine( L"The SOAP action, {0}, "
   L"is not valid for ExampleClass.GetHello", getHelloSoapAction );
}

// Register the SOAP action for the GetHello method.
SoapServices::RegisterSoapActionForMethodBase( getHelloMethodBase );

// Get the type and the method names encoded into the SOAP action.
String^ encodedTypeName;
String^ encodedMethodName;
SoapServices::GetTypeAndMethodNameFromSoapAction(
   getHelloSoapAction,encodedTypeName,encodedMethodName );
Console::WriteLine( L"The type name encoded in this SOAP action is {0}.",
   encodedTypeName );
Console::WriteLine( L"The method name encoded in this SOAP action is {0}.",
   encodedMethodName );
// Get the SOAP action for the method.
System.Reflection.MethodBase getHelloMethodBase = 
    typeof(ExampleNamespace.ExampleClass).GetMethod("GetHello");
string getHelloSoapAction =
    SoapServices.GetSoapActionFromMethodBase(getHelloMethodBase);
Console.WriteLine(
    "The SOAP action for the method " +
    "ExampleClass.GetHello is {0}.", getHelloSoapAction);
bool isSoapActionValid = SoapServices.IsSoapActionValidForMethodBase(
    getHelloSoapAction,
    getHelloMethodBase);
if (isSoapActionValid)
{
    Console.WriteLine(
        "The SOAP action, {0}, " + 
        "is valid for ExampleClass.GetHello", 
        getHelloSoapAction);
}
else
{
    Console.WriteLine(
        "The SOAP action, {0}, " + 
        "is not valid for ExampleClass.GetHello", 
        getHelloSoapAction);
}

// Register the SOAP action for the GetHello method.
SoapServices.RegisterSoapActionForMethodBase(getHelloMethodBase);

// Get the type and the method names encoded into the SOAP action.
string encodedTypeName;
string encodedMethodName;
SoapServices.GetTypeAndMethodNameFromSoapAction(
    getHelloSoapAction, 
    out encodedTypeName, 
    out encodedMethodName);
Console.WriteLine(
    "The type name encoded in this SOAP action is {0}.",
    encodedTypeName);
Console.WriteLine(
    "The method name encoded in this SOAP action is {0}.",
    encodedMethodName);

注釈

指定 MethodBase された が SOAPAction 値に登録されていない場合、 GetSoapActionFromMethodBase メソッドは を使用して自動的にキャッシュされた SOAPAction を MethodBase返します。

適用対象