Bagikan melalui


SoapServices.RegisterSoapActionForMethodBase Metode

Definisi

Mengaitkan nilai SOAPAction dengan yang disediakan MethodBase.

Overload

RegisterSoapActionForMethodBase(MethodBase)

Mengaitkan yang ditentukan MethodBase dengan SOAPAction yang di-cache dengannya.

RegisterSoapActionForMethodBase(MethodBase, String)

Mengaitkan nilai SOAPAction yang disediakan dengan yang diberikan MethodBase untuk digunakan dalam sink saluran.

RegisterSoapActionForMethodBase(MethodBase)

Mengaitkan yang ditentukan MethodBase dengan SOAPAction yang di-cache dengannya.

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)

Parameter

mb
MethodBase

Metode MethodBase untuk mengaitkan dengan SOAPAction yang di-cache dengannya.

Atribut

Pengecualian

Pemanggil langsung tidak memiliki izin infrastruktur.

Contoh

Contoh kode berikut menunjukkan cara menggunakan metode ini. Contoh kode ini adalah bagian dari contoh yang lebih besar yang disediakan untuk SoapServices kelas .

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

Keterangan

SOAPAction dari metode yang ditentukan terkandung dalam SoapMethodAttribute.SoapAction properti , atau dibaca dari kabel. Metode saat ini mengaitkan SOAPAction dengan MethodBase untuk digunakan dalam sink saluran.

Bidang header permintaan HTTP SOAPAction menunjukkan niat permintaan HTTP SOAP. Nilainya adalah URI yang mengidentifikasi niat. SOAP tidak menempatkan batasan pada format atau kekhususan URI atau yang dapat diselesaikan. Klien HTTP harus menggunakan bidang header ini saat mengeluarkan permintaan HTTP SOAP.

Berlaku untuk

RegisterSoapActionForMethodBase(MethodBase, String)

Mengaitkan nilai SOAPAction yang disediakan dengan yang diberikan MethodBase untuk digunakan dalam sink saluran.

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)

Parameter

mb
MethodBase

MethodBase untuk mengaitkan dengan SOAPAction yang disediakan.

soapAction
String

Nilai SOAPAction untuk dikaitkan dengan yang diberikan MethodBase.

Pengecualian

Pemanggil langsung tidak memiliki izin infrastruktur.

Contoh

Contoh kode berikut menunjukkan cara menggunakan metode ini. Contoh kode ini adalah bagian dari contoh yang lebih besar yang disediakan untuk SoapServices kelas .

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

Keterangan

Bidang header permintaan HTTP SOAPAction menunjukkan niat permintaan HTTP SOAP. Nilainya adalah URI yang mengidentifikasi niat. SOAP tidak menempatkan batasan pada format atau kekhususan URI atau yang dapat diselesaikan. Klien HTTP harus menggunakan bidang header ini saat mengeluarkan permintaan HTTP SOAP.

Berlaku untuk