ReturnFormatter Property
Collapse the table of content
Expand the table of content

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 Value

Type: System.Type

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

.NET Framework
Available since 1.1
Return to top
Show:
© 2016 Microsoft