共用方式為


SoapMethodAttribute.ResponseXmlElementName 屬性

定義

取得或設定做為對目標方法的方法回應的 XML 項目名稱。

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

屬性值

做為對目標方法的方法回應的 XML 項目名稱。

範例

下列程式碼範例示範如何使用 ResponseXmlElementName 屬性。 此程式代碼範例是提供給 類別之較大範例的 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;
}

備註

此屬性的預設值是附加至方法名稱的字串 「Response」。

適用於