SoapMethodAttribute.XmlNamespace 屬性

定義

取得或設定在目標方法的遠端方法呼叫的序列化期間 (Serialization) 所使用的 XML 命名空間。

public:
 virtual property System::String ^ XmlNamespace { System::String ^ get(); void set(System::String ^ value); };
public override string XmlNamespace { get; set; }
member this.XmlNamespace : string with get, set
Public Overrides Property XmlNamespace As String

屬性值

在目標方法的遠端方法呼叫的序列化期間所使用的 XML 命名空間。

範例

下列程式碼範例示範如何使用 XmlNamespace 屬性。 此程式代碼範例是提供給 類別之較大範例的 SoapMethodAttribute 一部分。

[SoapMethod(
   ResponseXmlElementName="ExampleResponseElement",
   ResponseXmlNamespace=
   "http://example.org/MethodResponseXmlNamespace",
   ReturnXmlElementName="HelloMessage",
   SoapAction="http://example.org/ExampleSoapAction#GetHello",
   XmlNamespace="http://example.org/MethodCallXmlNamespace")]
String^ GetHello( String^ name )
{
   return String::Format( L"Hello, {0}", name );
}
[SoapMethod(
     ResponseXmlElementName="ExampleResponseElement",
     ResponseXmlNamespace=
        "http://example.org/MethodResponseXmlNamespace",
     ReturnXmlElementName="HelloMessage",
     SoapAction="http://example.org/ExampleSoapAction#GetHello",
     XmlNamespace="http://example.org/MethodCallXmlNamespace")]
public string GetHello(string name)
{
    return "Hello, " + name;
}

適用於