Bagikan melalui


SoapMethodAttribute.ResponseXmlElementName Properti

Definisi

Mendapatkan atau mengatur nama elemen XML yang akan digunakan untuk respons metode ke metode target.

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

Nilai Properti

Nama elemen XML yang digunakan untuk respons metode terhadap metode target.

Contoh

Contoh kode berikut menunjukkan cara menggunakan ResponseXmlElementName 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;
}

Keterangan

Nilai default properti ini adalah string "Respons" yang ditambahkan ke nama metode .

Berlaku untuk