I have a Web Service which I call ASynchronously. The problem its not
getting kicked off. This is how I am calling it over HTTP and after
calling the webservice I have a redirect to another page. I don't know
if that is allowed.
Here is how I call it on a click of a button.
COASTWebService.DeployService proxy = new
COASTWebService.DeployService();
IAsyncResult result;
result = proxy.BeginBuildPackage(deploymentID,
_currentPageParam.BranchID, null, null);
Session["IAsyncResult"] = result; //I really do not need this
Response.Redirect(string.Format("DeployStatus.aspx ?deployment_id={0}&branch_id={1}",deploymentID,_cu rrentPageParam.BranchID),true);
This is the web service code
namespace Composer.WebUI.COASTWebService {
using System.Diagnostics;
using System.Xml.Serialization;
using System;
using System.Web.Services.Protocols;
using System.ComponentModel;
using System.Web.Services;
/// <remarks/>
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("c ode")]
[System.Web.Services.WebServiceBindingAttribute(Nam e="DeployServiceSoap",
Namespace="http://tempuri.org/")]
public class DeployService :
System.Web.Services.Protocols.SoapHttpClientProtoc ol {
/// <remarks/>
public DeployService() {
this.Url =
"http://localhost/COASTWebService/DeployService.asmx";
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAt tribute("http://tempuri.org/BuildPackage",
RequestNamespace="http://tempuri.org/",
ResponseNamespace="http://tempuri.org/",
Use=System.Web.Services.Description.SoapBindingUse .Literal,
ParameterStyle=System.Web.Services.Protocols.SoapP arameterStyle.Wrapped)]
public void BuildPackage(int deploymentID, int branchID) {
this.Invoke("BuildPackage", new object[] {
deploymentID,
branchID});
}
/// <remarks/>
public System.IAsyncResult BeginBuildPackage(int deploymentID,
int branchID, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("BuildPackage", new object[] {
deploymentID,
branchID}, callback, asyncState);
}
/// <remarks/>
public void EndBuildPackage(System.IAsyncResult asyncResult) {
this.EndInvoke(asyncResult);
}
}
}
In the redirected page, on the LOAD of page this is what I do. I really
not do this as I constantly keep polling in the DB so I know the exact
state. But its just not happening.
if (Session["IAsyncResult"] != null)
{
COASTWebService.DeployService proxy = new
Composer.WebUI.COASTWebService.DeployService();
result = (IAsyncResult)Session["IAsyncResult"];
if (result.IsCompleted)
{
proxy.EndBuildPackage(result);
}
}
I am new to Async concept so please be easy...
Thanks