Бөлісу құралы:


SoapServices.RegisterSoapActionForMethodBase Метод

Определение

Связывает значение SOAPAction с предоставленным MethodBase.

Перегрузки

Имя Описание
RegisterSoapActionForMethodBase(MethodBase)

Связывает указанный MethodBase с файлом SOAPAction, кэшированный с ним.

RegisterSoapActionForMethodBase(MethodBase, String)

Связывает предоставленное значение SOAPAction с заданным MethodBase для использования в приемниках каналов.

RegisterSoapActionForMethodBase(MethodBase)

Связывает указанный MethodBase с файлом 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)

Параметры

mb
MethodBase

Метод MethodBase , связанный с soapAction, кэшируемым с ним.

Атрибуты

Исключения

Непосредственный вызывающий объект не имеет разрешения на инфраструктуру.

Примеры

В следующем примере кода показано, как использовать этот метод. Этот пример кода является частью более крупного примера, предоставленного для 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));

Комментарии

SOAPAction указанного метода содержится в свойстве SoapMethodAttribute.SoapAction или считывается от провода. Текущий метод связывает SOAPAction с MethodBase используемым в приемниках каналов.

Поле заголовка HTTP-запроса SOAPAction указывает намерение HTTP-запроса SOAP. Значением является универсальный код ресурса (URI), определяющий намерение. SOAP не накладывает ограничений на формат или специфику универсального кода ресурса (URI) или его разрешение. Http-клиент должен использовать это поле заголовка при выдаче HTTP-запроса SOAP.

Применяется к

RegisterSoapActionForMethodBase(MethodBase, String)

Связывает предоставленное значение SOAPAction с заданным MethodBase для использования в приемниках каналов.

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)

Параметры

mb
MethodBase

Значение MethodBase для связывания с предоставленным SOAPAction.

soapAction
String

Значение SOAPAction, которое необходимо связать с заданным MethodBase.

Исключения

Непосредственный вызывающий объект не имеет разрешения на инфраструктуру.

Примеры

В следующем примере кода показано, как использовать этот метод. Этот пример кода является частью более крупного примера, предоставленного для 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));

Комментарии

Поле заголовка HTTP-запроса SOAPAction указывает намерение HTTP-запроса SOAP. Значением является универсальный код ресурса (URI), определяющий намерение. SOAP не накладывает ограничений на формат или специфику универсального кода ресурса (URI) или его разрешение. Http-клиент должен использовать это поле заголовка при выдаче HTTP-запроса SOAP.

Применяется к