Export (0) Print
Expand All

SoapServices.IsSoapActionValidForMethodBase Method

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

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

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.

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

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Show:
© 2015 Microsoft