Share via


SoapServices.RegisterSoapActionForMethodBase Metoda

Definice

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

Přetížení

RegisterSoapActionForMethodBase(MethodBase)

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

RegisterSoapActionForMethodBase(MethodBase, String)

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

RegisterSoapActionForMethodBase(MethodBase)

Přidruží zadanou MethodBase akci 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

Metodu MethodBase , která se má přidružit k akci SOAPAction, která je s ní uložena 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 tuto metodu použít. Tento příklad kódu je součástí většího příkladu SoapServices pro třídu .

// 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 z drátu. Aktuální metoda přidruží SOAPAction k objektu MethodBase pro použití v jímkách kanálů.

Pole hlavičky požadavku HTTP SOAPAction označuje záměr požadavku SOAP HTTP. Hodnota je identifikátor URI identifikující záměr. Protokol SOAP neukládá žádná omezení týkající se formátu nebo specifičnosti identifikátoru URI nebo jeho překladu. Klient HTTP musí toto pole hlavičky použít při vydávání požadavku HTTP protokolu SOAP.

Platí pro

RegisterSoapActionForMethodBase(MethodBase, String)

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

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

Chcete-li MethodBase přidružit k poskytnuté 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 tuto metodu použít. Tento příklad kódu je součástí většího příkladu SoapServices pro třídu .

// 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 SOAP HTTP. Hodnota je identifikátor URI identifikující záměr. Protokol SOAP neukládá žádná omezení týkající se formátu nebo specifičnosti identifikátoru URI nebo jeho překladu. Klient HTTP musí toto pole hlavičky použít při vydávání požadavku HTTP protokolu SOAP.

Platí pro