SoapServices.IsSoapActionValidForMethodBase(String, MethodBase) Method

Definition

Determines if the specified SOAPAction is acceptable for a given MethodBase.

C#
public static bool IsSoapActionValidForMethodBase(string soapAction, System.Reflection.MethodBase mb);
C#
[System.Security.SecurityCritical]
public static bool IsSoapActionValidForMethodBase(string soapAction, System.Reflection.MethodBase mb);

Parameters

soapAction
String

The SOAPAction to check against the given MethodBase.

mb
MethodBase

The MethodBase the specified SOAPAction is checked against.

Returns

true if the specified SOAPAction is acceptable for a given MethodBase; otherwise, false.

Attributes

Exceptions

The immediate caller does not have infrastructure permission.

Examples

The following code example shows how to use this method. This code example is part of a larger example provided for the SoapServices class.

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

Applies to

Product Versions
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1