Udostępnij za pośrednictwem


SoapMethodAttribute.ReturnXmlElementName Właściwość

Definicja

Pobiera lub ustawia nazwę elementu XML używaną dla wartości zwracanej z metody docelowej.

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

Wartość właściwości

Nazwa elementu XML używana dla wartości zwracanej z metody docelowej.

Przykłady

W poniższym przykładzie kodu pokazano, jak używać ReturnXmlElementName właściwości . Ten przykład kodu jest częścią większego przykładu udostępnionego SoapMethodAttribute dla klasy .

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

Uwagi

Wartość domyślna tej właściwości to ciąg "__return".

Dotyczy