Bagikan melalui


SoapMethodAttribute.XmlNamespace Properti

Definisi

Mendapatkan atau mengatur namespace XML yang digunakan selama serialisasi panggilan metode jarak jauh dari metode target.

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

Nilai Properti

Namespace XML yang digunakan selama serialisasi panggilan metode jarak jauh dari metode target.

Contoh

Contoh kode berikut menunjukkan cara menggunakan XmlNamespace properti . Contoh kode ini adalah bagian dari contoh yang lebih besar yang disediakan untuk SoapMethodAttribute kelas .

[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;
}

Berlaku untuk