SoapServices.IsSoapActionValidForMethodBase Method (String, MethodBase)

 

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

Namespace:   System.Runtime.Remoting
Assembly:  mscorlib (in mscorlib.dll)

[SecurityCriticalAttribute]
public static bool IsSoapActionValidForMethodBase(
	string soapAction,
	MethodBase mb
)

Parameters

soapAction
Type: System.String

The SOAPAction to check against the given MethodBase.

mb
Type: System.Reflection.MethodBase

The MethodBase the specified SOAPAction is checked against.

Return Value

Type: System.Boolean

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

Exception Condition
SecurityException

The immediate caller does not have infrastructure permission.

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

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

SecurityPermission

for operating with infrastructure code. Associated enumeration: SecurityPermissionFlag.Infrastructure

.NET Framework
Available since 1.1
Return to top
Show: