Share via


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”。

适用于