Share via


SoapServices.GetTypeAndMethodNameFromSoapAction Methode

Definition

Bestimmt den Typ- und Methodennamen der Methode, die dem angegebenen SOAPAction-Wert zugeordnet ist.

public:
 static bool GetTypeAndMethodNameFromSoapAction(System::String ^ soapAction, [Runtime::InteropServices::Out] System::String ^ % typeName, [Runtime::InteropServices::Out] System::String ^ % methodName);
public static bool GetTypeAndMethodNameFromSoapAction (string soapAction, out string typeName, out string methodName);
static member GetTypeAndMethodNameFromSoapAction : string * string * string -> bool
Public Shared Function GetTypeAndMethodNameFromSoapAction (soapAction As String, ByRef typeName As String, ByRef methodName As String) As Boolean

Parameter

soapAction
String

SOAPAction der Methode, für die der Typ- und Methodenname angefordert wurde.

typeName
String

Enthält nach dem Beenden dieser Methode einen String mit dem Typnamen der betreffenden Methode. Dieser Parameter wird nicht initialisiert übergeben.

methodName
String

Enthält nach dem Beenden dieser Methode einen String mit dem Methodennamen der betreffenden Methode. Dieser Parameter wird nicht initialisiert übergeben.

Gibt zurück

true, wenn Typ- und Methodenname erfolgreich wiederhergestellt wurden, andernfalls false.

Ausnahmen

Der SOAPAction-Wert steht nicht in Anführungszeichen.

Der direkte Aufrufer verfügt nicht über die Berechtigung für die Infrastruktur.

Beispiele

Im folgenden Codebeispiel wird die Verwendung dieser Methode veranschaulicht. Dieses Codebeispiel ist Teil eines größeren Beispiels, das für die SoapServices-Klasse bereitgestellt wird.

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

Hinweise

true , wenn die Suche nach Typ- und Methodennamen erfolgreich war; falseandernfalls .

Gilt für: