SoapServices.RegisterSoapActionForMethodBase Metod

Definition

Associerar ett SOAPAction-värde med det angivna MethodBase.

Överlagringar

Name Description
RegisterSoapActionForMethodBase(MethodBase)

Associerar den angivna MethodBase med SOAPAction cachelagrad med den.

RegisterSoapActionForMethodBase(MethodBase, String)

Associerar det angivna SOAPAction-värdet med angivet MethodBase för användning i kanalmottagare.

RegisterSoapActionForMethodBase(MethodBase)

Associerar den angivna MethodBase med SOAPAction cachelagrad med den.

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)

Parametrar

mb
MethodBase

Metoden MethodBase som ska associeras med SOAPAction som cachelagras med den.

Attribut

Undantag

Den omedelbara anroparen har inte infrastrukturbehörighet.

Exempel

I följande kodexempel visas hur du använder den här metoden. Det här kodexemplet är en del av ett större exempel för SoapServices klassen.

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

Kommentarer

SOAPAction för den angivna metoden finns i SoapMethodAttribute.SoapAction egenskapen eller läss av kabeln. Den aktuella metoden associerar SOAPAction med MethodBase för användning i kanalmottagare.

FÄLTET SOAPAction HTTP-begärandehuvud anger avsikten med SOAP HTTP-begäran. Värdet är en URI som identifierar avsikten. SOAP begränsar inte URI:ns format eller specificitet eller att den kan matchas. En HTTP-klient måste använda det här rubrikfältet när en SOAP HTTP-begäran utfärdas.

Gäller för

RegisterSoapActionForMethodBase(MethodBase, String)

Associerar det angivna SOAPAction-värdet med angivet MethodBase för användning i kanalmottagare.

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)

Parametrar

mb
MethodBase

Att MethodBase associera med den tillhandahållna SOAPAction.

soapAction
String

SOAPAction-värdet som ska associeras med den angivna MethodBase.

Undantag

Den omedelbara anroparen har inte infrastrukturbehörighet.

Exempel

I följande kodexempel visas hur du använder den här metoden. Det här kodexemplet är en del av ett större exempel för SoapServices klassen.

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

Kommentarer

FÄLTET SOAPAction HTTP-begärandehuvud anger avsikten med SOAP HTTP-begäran. Värdet är en URI som identifierar avsikten. SOAP begränsar inte URI:ns format eller specificitet eller att den kan matchas. En HTTP-klient måste använda det här rubrikfältet när en SOAP HTTP-begäran utfärdas.

Gäller för