HttpMethodAttribute.ReturnFormatter HttpMethodAttribute.ReturnFormatter HttpMethodAttribute.ReturnFormatter HttpMethodAttribute.ReturnFormatter Property

Определение

Получает или задает объект Type, десериализирующий ответ метода веб-службы XML.Gets or sets a Type that deserializes the response from an XML Web service method.

public:
 property Type ^ ReturnFormatter { Type ^ get(); void set(Type ^ value); };
public Type ReturnFormatter { get; set; }
member this.ReturnFormatter : Type with get, set
Public Property ReturnFormatter As Type

Значение свойства

Объект Type, десериализующий ответ метода веб-службы XML.A Type that deserializes the response from an XML Web service method. Значение по умолчанию отсутствует.There is no default.

Примеры

Пример — класс прокси, созданный программой Wsdl.exe для клиент XML-веб-службы, с помощью HTTP-GET, параметр ReturnFormatter в требуемое значение свойства UrlParameterWriter.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.

[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 = "http://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 : 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
    Inherits System.Web.Services.Protocols.HttpGetClientProtocol
    
    Public Sub New()
        Me.Url = "http://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

Комментарии

Если клиент XML-веб-службы вызывает метод XML-веб-службы, с помощью HTTP-GET, ReturnFormatter должно быть UrlParameterWriter, тогда как клиент с помощью HTTP-POST необходимо установить ReturnFormatter для HtmlFormParameterWriter.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.

Применяется к