Aracılığıyla paylaş


SoapServices.IsSoapActionValidForMethodBase(String, MethodBase) Yöntem

Tanım

Belirtilen SOAPAction değerinin belirli MethodBasebir için kabul edilebilir olup olmadığını belirler.

public:
 static bool IsSoapActionValidForMethodBase(System::String ^ soapAction, System::Reflection::MethodBase ^ mb);
public static bool IsSoapActionValidForMethodBase (string soapAction, System.Reflection.MethodBase mb);
[System.Security.SecurityCritical]
public static bool IsSoapActionValidForMethodBase (string soapAction, System.Reflection.MethodBase mb);
static member IsSoapActionValidForMethodBase : string * System.Reflection.MethodBase -> bool
[<System.Security.SecurityCritical>]
static member IsSoapActionValidForMethodBase : string * System.Reflection.MethodBase -> bool
Public Shared Function IsSoapActionValidForMethodBase (soapAction As String, mb As MethodBase) As Boolean

Parametreler

soapAction
String

Verilen MethodBaseöğesine karşı denetlemek için SOAPAction.

mb
MethodBase

Belirtilen MethodBase SOAPAction denetlendi.

Döndürülenler

true belirtilen SOAPAction belirli MethodBasebir için kabul edilebilirse ; değilse, false.

Öznitelikler

Özel durumlar

Hemen çağıranın altyapı izni yok.

Örnekler

Aşağıdaki kod örneğinde bu yöntemin nasıl kullanılacağı gösterilmektedir. Bu kod örneği, sınıfı için SoapServices sağlanan daha büyük bir örneğin parçasıdır.

// 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);

Şunlara uygulanır