HttpSimpleClientProtocol::EndInvoke Method
Completes asynchronous invocation of an XML Web service method using HTTP.
Assembly: System.Web.Services (in System.Web.Services.dll)
Parameters
- asyncResult
- Type: System::IAsyncResult
The IAsyncResult returned from the BeginInvoke method.
Return Value
Type: System::ObjectAn array of objects containing the return value and any by reference or out parameters for the XML Web service method.
| Exception | Condition |
|---|---|
| ArgumentException | asyncResult is not the return value from the BeginInvoke method. |
The following code example is an ASP.NET Web Form, which calls an XML Web service named Math. Within the EnterBtn_Click function, the Web Form starts and completes an asynchronous invocation of the Add XML Web service method.
The following code example is a proxy class generated by the Web Services Description Language tool (Wsdl.exe) for the Math XML Web service below. Within the EndAdd method of the proxy class, the EndInvoke method starts an asynchronous invocation of the Add XML Web service method.
namespace MyMath { [XmlRootAttribute("snippet1>",Namespace="http://MyMath/",IsNullable=false)] public ref class Math: public HttpGetClientProtocol { public: Math() { this->Url = "http://www.contoso.com/math.asmx"; } [HttpMethodAttribute(System::Web::Services::Protocols::XmlReturnReader::typeid, System::Web::Services::Protocols::UrlParameterWriter::typeid)] int Add( String^ num1, String^ num2 ) { array<Object^>^temp0 = {num1,num2}; return *dynamic_cast<int^>(this->Invoke( "Add", String::Concat( this->Url, "/Add" ), temp0 )); } IAsyncResult^ BeginAdd( String^ num1, String^ num2, AsyncCallback^ callback, Object^ asyncState ) { array<Object^>^temp1 = {num1,num2}; return this->BeginInvoke( "Add", String::Concat( this->Url, "/Add" ), temp1, callback, asyncState ); } int EndAdd( IAsyncResult^ asyncResult ) { return *dynamic_cast<int^>(this->EndInvoke( asyncResult )); } }; }
namespace MyMath {
[XmlRootAttribute(S"int", Namespace=S"http://MyMath/", IsNullable=false)]
public __gc class Math : public HttpGetClientProtocol {
public:
Math()
{
this->Url = S"http://www.contoso.com/math.asmx";
}
[HttpMethodAttribute(__typeof(System::Web::Services::Protocols::XmlReturnReader),
__typeof(System::Web::Services::Protocols::UrlParameterWriter))]
int Add(String* num1, String* num2)
{
Object* temp0 [] = {num1, num2};
return *dynamic_cast<__box int*>(this->Invoke(S"Add", String::Concat(this->Url, S"/Add"), temp0));
}
IAsyncResult* BeginAdd(String* num1, String* num2, AsyncCallback* callback, Object* asyncState)
{
Object* temp1 [] = {num1, num2};
return this->BeginInvoke(S"Add", String::Concat(this->Url, S"/Add"), temp1, callback, asyncState);
}
int EndAdd(IAsyncResult* asyncResult)
{
return *dynamic_cast<__box int*>(this->EndInvoke(asyncResult));
}
};
}
The following code example is the Math XML Web service, from which the above proxy class was created.
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.