Freigeben über


HttpMethodAttribute.ReturnFormatter-Eigenschaft

Ruft einen Type ab, der die Antwort von einer XML-Webdienstmethode deserialisiert, oder legt diesen fest.

Namespace: System.Web.Services.Protocols
Assembly: System.Web.Services (in system.web.services.dll)

Syntax

'Declaration
Public Property ReturnFormatter As Type
'Usage
Dim instance As HttpMethodAttribute
Dim value As Type

value = instance.ReturnFormatter

instance.ReturnFormatter = value
public Type ReturnFormatter { get; set; }
public:
property Type^ ReturnFormatter {
    Type^ get ();
    void set (Type^ value);
}
/** @property */
public Type get_ReturnFormatter ()

/** @property */
public void set_ReturnFormatter (Type value)
public function get ReturnFormatter () : Type

public function set ReturnFormatter (value : Type)

Eigenschaftenwert

Ein Type, der die Antwort einer XML-Webdienstmethode deserialisiert. Es ist kein Standardwert vorhanden.

Hinweise

Wenn der XML-Webdienstclient eine XML-Webdienstmethode mit HTTP-GET aufruft, muss ReturnFormatter auf UrlParameterWriter festgelegt sein. Wenn ein Client HTTP-POST verwendet, muss er ReturnFormatter auf HtmlFormParameterWriter festlegen.

Beispiel

Die Proxyklasse im Beispiel wird vom Dienstprogramm Wsdl.exe für einen XML-Webdienstclient unter Verwendung von HTTP-GET generiert, wobei ReturnFormatter auf den erforderlichen Wert von UrlParameterWriter festgelegt wird.

Public Class MyUser
    Inherits System.Web.Services.Protocols.HttpGetClientProtocol
    
    Public Sub New()
        Me.Url = "https://www.contoso.com/username.asmx"
    End Sub 'New
    
    <HttpMethodAttribute(GetType(XmlReturnReader), GetType(UrlParameterWriter))> _
    Public Function GetUserName() As UserName
        Return CType(Me.Invoke("GetUserName", Me.Url + "/GetUserName", New Object(0) {}), UserName)
    End Function 'GetUserName
    
    Public Function BeginGetUserName(callback As System.AsyncCallback, asyncState As Object) As System.IAsyncResult
        Return Me.BeginInvoke("GetUserName", Me.Url + "/GetUserName", New Object(0) {}, callback, asyncState)
    End Function 'BeginGetUserName
    
    Public Function EndGetUserName(asyncResult As System.IAsyncResult) As UserName
        Return CType(Me.EndInvoke(asyncResult), UserName)
    End Function 'EndGetUserName
End Class 'MyUser

<XmlRootAttribute(Namespace := "http://tempuri.org/", IsNullable := True)> _
Public Class UserName
    Public Name As String
    Public Domain As String

End Class 'UserName
public class MyUser : System.Web.Services.Protocols.HttpGetClientProtocol {
    
    public MyUser() {
        this.Url = "https://www.contoso.com/username.asmx";
    }
    
    [System.Web.Services.Protocols.HttpMethodAttribute(typeof(System.Web.Services.Protocols.XmlReturnReader), typeof(System.Web.Services.Protocols.UrlParameterWriter))]
    public UserName GetUserName() {
        return ((UserName)(this.Invoke("GetUserName", (this.Url + "/GetUserName"), new object[0])));
    }
    
    public System.IAsyncResult BeginGetUserName(System.AsyncCallback callback, object asyncState) {
        return this.BeginInvoke("GetUserName", (this.Url + "/GetUserName"), new object[0], callback, asyncState);
    }
    
    public UserName EndGetUserName(System.IAsyncResult asyncResult) {
        return ((UserName)(this.EndInvoke(asyncResult)));
    }
}

[System.Xml.Serialization.XmlRootAttribute(Namespace="http://tempuri.org/", IsNullable=true)]
public class UserName {
    
    public string Name;
    
    public string Domain;
}
[System::Xml::Serialization::XmlRootAttribute(Namespace="http://tempuri.org/",IsNullable=true)]
public ref class UserName
{
public:
   String^ Name;
   String^ Domain;
};

public ref class MyUser: public System::Web::Services::Protocols::HttpGetClientProtocol
{
public:
   MyUser()
   {
      this->Url = "https://www.contoso.com/username.asmx";
   }

   [System::Web::Services::Protocols::HttpMethodAttribute(System::Web::Services::Protocols::XmlReturnReader::typeid,System::Web::Services::Protocols::UrlParameterWriter::typeid)]
   UserName^ GetUserName()
   {
      return (dynamic_cast<UserName^>(this->Invoke( "GetUserName", (String::Concat( this->Url, "/GetUserName" )), gcnew array<Object^>(0) )));
   }

   System::IAsyncResult^ BeginGetUserName( System::AsyncCallback^ callback, Object^ asyncState )
   {
      return this->BeginInvoke( "GetUserName", (String::Concat( this->Url, "/GetUserName" )), gcnew array<Object^>(0), callback, asyncState );
   }

   UserName^ EndGetUserName( System::IAsyncResult^ asyncResult )
   {
      return (dynamic_cast<UserName^>(this->EndInvoke( asyncResult )));
   }
};
public class MyUser extends System.Web.Services.Protocols.HttpGetClientProtocol
{    
    public MyUser()
    {
        this.set_Url("https://www.contoso.com/username.asmx");
    } //MyUser

    /** @attribute System.Web.Services.Protocols.HttpMethodAttribute(
        System.Web.Services.Protocols.XmlReturnReader .class, 
        System.Web.Services.Protocols.UrlParameterWriter .class)
     */
    public UserName GetUserName()
    {
        return ((UserName)(this.Invoke("GetUserName", this.get_Url()
            + "/GetUserName", new Object[0])));
    } //GetUserName

    public System.IAsyncResult BeginGetUserName(System.AsyncCallback callback,
        Object asyncState)
    {
        return this.BeginInvoke("GetUserName", this.get_Url()
            + "/GetUserName", new Object[0], callback, asyncState);
    } //BeginGetUserName

    public UserName EndGetUserName(System.IAsyncResult asyncResult)
    {
        return ((UserName)(this.EndInvoke(asyncResult)));
    } //EndGetUserName
} //MyUser

/** @attribute System.Xml.Serialization.XmlRootAttribute(
    Namespace = "http://tempuri.org/", IsNullable = true)
 */
public class UserName
{
    public String name;
    public String domain;
} //UserName
class MyUser extends System.Web.Services.Protocols.HttpGetClientProtocol{
    
    function MyUser(){
        this.Url = "https://www.contoso.com/username.asmx"
    } //New
    
    public HttpMethodAttribute(XmlReturnReader, UrlParameterWriter)
    function GetUserName() : UserName{
        return UserName(this.Invoke("GetUserName", this.Url + "/GetUserName", new Object[0]))
    } //GetUserName

    function BeginGetUserName(callback : System.AsyncCallback, asyncState : Object) : System.IAsyncResult{
        return this.BeginInvoke("GetUserName", this.Url + "/GetUserName", new Object[0], callback, asyncState)
    } //BeginGetUserName

    function EndGetUserName(asyncResult : System.IAsyncResult) : UserName{
        return UserName(this.EndInvoke(asyncResult))
    } //EndGetUserName
} //MyUser

public XmlRootAttribute(Namespace = "http://tempuri.org/", IsNullable = true)
class UserName{
    var Name : String
    var Domain : String
} //UserName

Plattformen

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

HttpMethodAttribute-Klasse
HttpMethodAttribute-Member
System.Web.Services.Protocols-Namespace