Compartilhar via


SoapServices.RegisterSoapActionForMethodBase Método

Definição

Associa um valor SOAPAction ao fornecido MethodBase.

Sobrecargas

Nome Description
RegisterSoapActionForMethodBase(MethodBase)

Associa o especificado MethodBase ao SOAPAction armazenado em cache com ele.

RegisterSoapActionForMethodBase(MethodBase, String)

Associa o valor SOAPAction fornecido ao fornecido MethodBase para uso em coletores de canal.

RegisterSoapActionForMethodBase(MethodBase)

Associa o especificado MethodBase ao SOAPAction armazenado em cache com ele.

public:
 static void RegisterSoapActionForMethodBase(System::Reflection::MethodBase ^ mb);
public static void RegisterSoapActionForMethodBase(System.Reflection.MethodBase mb);
[System.Security.SecurityCritical]
public static void RegisterSoapActionForMethodBase(System.Reflection.MethodBase mb);
static member RegisterSoapActionForMethodBase : System.Reflection.MethodBase -> unit
[<System.Security.SecurityCritical>]
static member RegisterSoapActionForMethodBase : System.Reflection.MethodBase -> unit
Public Shared Sub RegisterSoapActionForMethodBase (mb As MethodBase)

Parâmetros

mb
MethodBase

O MethodBase método a ser associado ao SOAPAction armazenado em cache com ele.

Atributos

Exceções

O chamador imediato não tem permissão de infraestrutura.

Exemplos

O exemplo de código a seguir mostra como usar esse método. Este exemplo de código faz parte de um exemplo maior fornecido para a SoapServices classe.

// Get the method base object for the GetHello method.
System::Reflection::MethodBase^ methodBase = 
  ExampleNamespace::ExampleClass::typeid->GetMethod( L"GetHello" );

// Print its current SOAP action.
Console::WriteLine( L"The SOAP action for the method "
   L"ExampleClass.GetHello is {0}.",
   SoapServices::GetSoapActionFromMethodBase( methodBase ) );

// Set the SOAP action of the GetHello method to a new value.
String^ newSoapAction = L"http://example.org/ExampleSoapAction#NewSoapAction";
SoapServices::RegisterSoapActionForMethodBase( methodBase, newSoapAction );
Console::WriteLine( L"The SOAP action for the method "
   L"ExampleClass.GetHello is {0}.",
   SoapServices::GetSoapActionFromMethodBase( methodBase ) );

// Reset the SOAP action of the GetHello method to its default
// value, which is determined using its SoapMethod attribute.
SoapServices::RegisterSoapActionForMethodBase( methodBase );
Console::WriteLine( L"The SOAP action for the method "
   L"ExampleClass.GetHello is {0}.",
   SoapServices::GetSoapActionFromMethodBase( methodBase ) );
// Get the method base object for the GetHello method.
System.Reflection.MethodBase methodBase = 
    typeof(ExampleNamespace.ExampleClass).GetMethod("GetHello");

// Print its current SOAP action.
Console.WriteLine(
    "The SOAP action for the method " +
    "ExampleClass.GetHello is {0}.",
    SoapServices.GetSoapActionFromMethodBase(methodBase));

// Set the SOAP action of the GetHello method to a new value.
string newSoapAction = 
    "http://example.org/ExampleSoapAction#NewSoapAction";
SoapServices.RegisterSoapActionForMethodBase(
    methodBase, newSoapAction);
Console.WriteLine(
    "The SOAP action for the method " +
    "ExampleClass.GetHello is {0}.",
    SoapServices.GetSoapActionFromMethodBase(methodBase));

// Reset the SOAP action of the GetHello method to its default
// value, which is determined using its SoapMethod attribute.
SoapServices.RegisterSoapActionForMethodBase(methodBase);
Console.WriteLine(
    "The SOAP action for the method " +
    "ExampleClass.GetHello is {0}.",
    SoapServices.GetSoapActionFromMethodBase(methodBase));

Comentários

O SOAPAction do método especificado está contido na SoapMethodAttribute.SoapAction propriedade ou é lido fora do fio. O método atual associa o SOAPAction ao MethodBase uso em coletores de canal.

O campo de cabeçalho de solicitação HTTP SOAPAction indica a intenção da solicitação HTTP SOAP. O valor é um URI que identifica a intenção. SOAP não impõe restrições ao formato ou à especificidade do URI ou que ele é resolvível. Um cliente HTTP deve usar esse campo de cabeçalho ao emitir uma solicitação HTTP SOAP.

Aplica-se a

RegisterSoapActionForMethodBase(MethodBase, String)

Associa o valor SOAPAction fornecido ao fornecido MethodBase para uso em coletores de canal.

public:
 static void RegisterSoapActionForMethodBase(System::Reflection::MethodBase ^ mb, System::String ^ soapAction);
public static void RegisterSoapActionForMethodBase(System.Reflection.MethodBase mb, string soapAction);
static member RegisterSoapActionForMethodBase : System.Reflection.MethodBase * string -> unit
Public Shared Sub RegisterSoapActionForMethodBase (mb As MethodBase, soapAction As String)

Parâmetros

mb
MethodBase

O MethodBase para associar ao SOAPAction fornecido.

soapAction
String

O valor SOAPAction a ser associado ao determinado MethodBase.

Exceções

O chamador imediato não tem permissão de infraestrutura.

Exemplos

O exemplo de código a seguir mostra como usar esse método. Este exemplo de código faz parte de um exemplo maior fornecido para a SoapServices classe.

// Get the method base object for the GetHello method.
System::Reflection::MethodBase^ methodBase = 
  ExampleNamespace::ExampleClass::typeid->GetMethod( L"GetHello" );

// Print its current SOAP action.
Console::WriteLine( L"The SOAP action for the method "
   L"ExampleClass.GetHello is {0}.",
   SoapServices::GetSoapActionFromMethodBase( methodBase ) );

// Set the SOAP action of the GetHello method to a new value.
String^ newSoapAction = L"http://example.org/ExampleSoapAction#NewSoapAction";
SoapServices::RegisterSoapActionForMethodBase( methodBase, newSoapAction );
Console::WriteLine( L"The SOAP action for the method "
   L"ExampleClass.GetHello is {0}.",
   SoapServices::GetSoapActionFromMethodBase( methodBase ) );

// Reset the SOAP action of the GetHello method to its default
// value, which is determined using its SoapMethod attribute.
SoapServices::RegisterSoapActionForMethodBase( methodBase );
Console::WriteLine( L"The SOAP action for the method "
   L"ExampleClass.GetHello is {0}.",
   SoapServices::GetSoapActionFromMethodBase( methodBase ) );
// Get the method base object for the GetHello method.
System.Reflection.MethodBase methodBase = 
    typeof(ExampleNamespace.ExampleClass).GetMethod("GetHello");

// Print its current SOAP action.
Console.WriteLine(
    "The SOAP action for the method " +
    "ExampleClass.GetHello is {0}.",
    SoapServices.GetSoapActionFromMethodBase(methodBase));

// Set the SOAP action of the GetHello method to a new value.
string newSoapAction = 
    "http://example.org/ExampleSoapAction#NewSoapAction";
SoapServices.RegisterSoapActionForMethodBase(
    methodBase, newSoapAction);
Console.WriteLine(
    "The SOAP action for the method " +
    "ExampleClass.GetHello is {0}.",
    SoapServices.GetSoapActionFromMethodBase(methodBase));

// Reset the SOAP action of the GetHello method to its default
// value, which is determined using its SoapMethod attribute.
SoapServices.RegisterSoapActionForMethodBase(methodBase);
Console.WriteLine(
    "The SOAP action for the method " +
    "ExampleClass.GetHello is {0}.",
    SoapServices.GetSoapActionFromMethodBase(methodBase));

Comentários

O campo de cabeçalho de solicitação HTTP SOAPAction indica a intenção da solicitação HTTP SOAP. O valor é um URI que identifica a intenção. SOAP não impõe restrições ao formato ou à especificidade do URI ou que ele é resolvível. Um cliente HTTP deve usar esse campo de cabeçalho ao emitir uma solicitação HTTP SOAP.

Aplica-se a