SoapServices.GetXmlNamespaceForMethodCall(MethodBase) 方法

定义

检索在远程调用给定 MethodBase 中指定的方法时使用的 XML 命名空间。

public:
 static System::String ^ GetXmlNamespaceForMethodCall(System::Reflection::MethodBase ^ mb);
public static string GetXmlNamespaceForMethodCall (System.Reflection.MethodBase mb);
[System.Security.SecurityCritical]
public static string GetXmlNamespaceForMethodCall (System.Reflection.MethodBase mb);
static member GetXmlNamespaceForMethodCall : System.Reflection.MethodBase -> string
[<System.Security.SecurityCritical>]
static member GetXmlNamespaceForMethodCall : System.Reflection.MethodBase -> string
Public Shared Function GetXmlNamespaceForMethodCall (mb As MethodBase) As String

参数

mb
MethodBase

为其请求 XML 命名空间的方法的 MethodBase

返回

String

在远程调用指定方法时使用的 XML 命名空间。

属性

例外

直接调用方没有基础结构权限。

示例

下面的代码示例演示如何使用此方法。 此代码示例是为类提供的大型示例的 SoapServices 一部分。

// Print the XML namespace for a method invocation and its
// response.
System::Reflection::MethodBase^ getHelloMethod =
   ExampleNamespace::ExampleClass::typeid->GetMethod( L"GetHello" );
String^ methodCallXmlNamespace =
   SoapServices::GetXmlNamespaceForMethodCall( getHelloMethod );
String^ methodResponseXmlNamespace =
   SoapServices::GetXmlNamespaceForMethodResponse( getHelloMethod );
Console::WriteLine( L"The XML namespace for the invocation of the method "
L"GetHello in ExampleClass is {0}.", methodResponseXmlNamespace );
Console::WriteLine( L"The XML namespace for the response of the method "
L"GetHello in ExampleClass is {0}.", methodCallXmlNamespace );
// Print the XML namespace for a method invocation and its
// response.
System.Reflection.MethodBase getHelloMethod = 
    typeof(ExampleNamespace.ExampleClass).GetMethod("GetHello");
string methodCallXmlNamespace = 
    SoapServices.GetXmlNamespaceForMethodCall(getHelloMethod);
string methodResponseXmlNamespace =
    SoapServices.GetXmlNamespaceForMethodResponse(getHelloMethod);
Console.WriteLine(
    "The XML namespace for the invocation of the method " +
    "GetHello in ExampleClass is {0}.",
    methodResponseXmlNamespace);
Console.WriteLine(
    "The XML namespace for the response of the method " +
    "GetHello in ExampleClass is {0}.",
    methodCallXmlNamespace);

适用于