Export (0) Print
Expand All

HttpMethodAttribute.ReturnFormatter Property

Gets or sets a Type that deserializes the response from an XML Web service method.

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

public Type ReturnFormatter { get; set; }
/** @property */
public Type get_ReturnFormatter ()

/** @property */
public void set_ReturnFormatter (Type value)

public function get ReturnFormatter () : Type

public function set ReturnFormatter (value : Type)

Not applicable.

Property Value

A Type that deserializes the response from an XML Web service method. There is no default.

If the XML Web service client is invoking an XML Web service method using HTTP-GET, ReturnFormatter must be UrlParameterWriter, whereas a client using HTTP-POST must set ReturnFormatter to HtmlFormParameterWriter.

The example is a proxy class generated by the Wsdl.exe utility for an XML Web service client using HTTP-GET, setting ReturnFormatter to the required value of UrlParameterWriter.

public class MyUser : System.Web.Services.Protocols.HttpGetClientProtocol {
    
    public MyUser() {
        this.Url = "http://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;
}


public class MyUser extends System.Web.Services.Protocols.HttpGetClientProtocol
{    
    public MyUser()
    {
        this.set_Url("http://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 = "http://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

Windows 98, Windows Server 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

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2015 Microsoft