Sdílet prostřednictvím


SoapServices.RegisterSoapActionForMethodBase Metoda

Definice

Přidruží hodnotu SOAPAction k poskytnutému MethodBase.

Přetížení

Name Description
RegisterSoapActionForMethodBase(MethodBase)

Přidruží zadanou MethodBase metodu SOAPAction uloženou v mezipaměti.

RegisterSoapActionForMethodBase(MethodBase, String)

Přidruží zadanou hodnotu SOAPAction k zadané MethodBase hodnotě pro použití v jímkách kanálu.

RegisterSoapActionForMethodBase(MethodBase)

Přidruží zadanou MethodBase metodu SOAPAction uloženou v mezipaměti.

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)

Parametry

mb
MethodBase

Metoda MethodBase , která se k ní přidruží k protokolu SOAPAction uložená v mezipaměti.

Atributy

Výjimky

Bezprostřední volající nemá oprávnění k infrastruktuře.

Příklady

Následující příklad kódu ukazuje, jak použít tuto metodu. Tento příklad kódu je součástí většího příkladu uvedeného pro třídu SoapServices.

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

Poznámky

SOAPAction zadané metody je obsažena ve SoapMethodAttribute.SoapAction vlastnosti, nebo je přečtena drát. Aktuální metoda přidruží metodu SOAPAction k MethodBase použití v jímkách kanálu.

Pole hlavičky požadavku HTTP SOAPAction označuje záměr požadavku HTTP protokolu SOAP. Hodnota je identifikátor URI identifikující záměr. Protokol SOAP neumisťuje žádná omezení formátu nebo specifikity identifikátoru URI nebo je možné ho přeložit. Klient HTTP musí při vydávání požadavku HTTP PROTOKOLU SOAP použít toto pole hlavičky.

Platí pro

RegisterSoapActionForMethodBase(MethodBase, String)

Přidruží zadanou hodnotu SOAPAction k zadané MethodBase hodnotě pro použití v jímkách kanálu.

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)

Parametry

mb
MethodBase

Přidružení MethodBase k poskytnuté akci SOAPAction.

soapAction
String

Hodnota SOAPAction, která se má přidružit k danému MethodBase.

Výjimky

Bezprostřední volající nemá oprávnění k infrastruktuře.

Příklady

Následující příklad kódu ukazuje, jak použít tuto metodu. Tento příklad kódu je součástí většího příkladu uvedeného pro třídu SoapServices.

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

Poznámky

Pole hlavičky požadavku HTTP SOAPAction označuje záměr požadavku HTTP protokolu SOAP. Hodnota je identifikátor URI identifikující záměr. Protokol SOAP neumisťuje žádná omezení formátu nebo specifikity identifikátoru URI nebo je možné ho přeložit. Klient HTTP musí při vydávání požadavku HTTP PROTOKOLU SOAP použít toto pole hlavičky.

Platí pro