SoapServices.RegisterSoapActionForMethodBase Metoda

Definicja

Kojarzy wartość SOAPAction z podanym MethodBaseelementem .

Przeciążenia

RegisterSoapActionForMethodBase(MethodBase)

Kojarzy określony MethodBase z buforowanym elementem SOAPAction.

RegisterSoapActionForMethodBase(MethodBase, String)

Kojarzy podaną wartość SOAPAction z daną MethodBase wartością do użycia w ujściach kanału.

RegisterSoapActionForMethodBase(MethodBase)

Kojarzy określony MethodBase z buforowanym elementem SOAPAction.

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 , która ma być skojarzona z buforowanym elementem SOAPAction.

Atrybuty

Wyjątki

Bezpośredni obiekt wywołujący nie ma uprawnień do infrastruktury.

Przykłady

W poniższym przykładzie kodu pokazano, jak używać tej metody. Ten przykład kodu jest częścią większego przykładu udostępnionego SoapServices dla klasy .

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

Uwagi

Funkcja SOAPAction określonej metody jest zawarta we SoapMethodAttribute.SoapAction właściwości lub jest odczytywana z przewodu. Bieżąca metoda kojarzy metodę SOAPAction z funkcją MethodBase do użycia w ujściach kanału.

Pole nagłówka żądania HTTP protokołu SOAPAction wskazuje intencję żądania HTTP protokołu SOAP. Wartość to identyfikator URI identyfikujący intencję. Soap nie nakłada żadnych ograniczeń na format lub specyfikę identyfikatora URI lub jest rozpoznawalny. Klient HTTP musi używać tego pola nagłówka podczas wystawiania żądania HTTP protokołu SOAP.

Dotyczy

RegisterSoapActionForMethodBase(MethodBase, String)

Kojarzy podaną wartość SOAPAction z daną MethodBase wartością do użycia w ujściach kanału.

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

Element MethodBase do skojarzenia z podanym elementem SOAPAction.

soapAction
String

Wartość SOAPAction do skojarzenia z danym MethodBaseelementem .

Wyjątki

Bezpośredni obiekt wywołujący nie ma uprawnień do infrastruktury.

Przykłady

W poniższym przykładzie kodu pokazano, jak używać tej metody. Ten przykład kodu jest częścią większego przykładu udostępnionego SoapServices dla klasy .

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

Uwagi

Pole nagłówka żądania HTTP protokołu SOAPAction wskazuje intencję żądania HTTP protokołu SOAP. Wartość to identyfikator URI identyfikujący intencję. Soap nie nakłada żadnych ograniczeń na format lub specyfikę identyfikatora URI lub jest rozpoznawalny. Klient HTTP musi używać tego pola nagłówka podczas wystawiania żądania HTTP protokołu SOAP.

Dotyczy