Share via


SoapServices.GetTypeAndMethodNameFromSoapAction Méthode

Définition

Détermine le type et le nom de la méthode associée à la valeur SOAPAction spécifiée.

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

Paramètres

soapAction
String

SOAPAction de la méthode pour laquelle les noms de types et de méthodes ont été demandés.

typeName
String

Lorsque cette méthode est retournée, contient un String contenant le nom de type de la méthode concernée. Ce paramètre est passé sans être initialisé.

methodName
String

Lorsque cette méthode est retournée, contient un String comportant le nom de la méthode concernée. Ce paramètre est passé sans être initialisé.

Retours

true si le type et le nom de méthode ont été correctement extraits ; sinon false.

Exceptions

La valeur SOAPAction ne comporte pas de guillemets ouvrants et fermants.

L'appelant immédiat n'a pas d'autorisation d'accès à l'infrastructure.

Exemples

L'exemple de code suivant montre comment utiliser cette méthode. Cet exemple de code fait partie d’un exemple plus grand fourni pour la SoapServices classe .

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

Remarques

true si les recherches de type et de nom de méthode ont réussi ; sinon, false.

S’applique à