I've added WCF Service reference to my asp.net application and configured that reference to support asncronious calls. From asp.net code behind files, i'm able to call the service methods asyncroniously as shown in the bellow sample code.
protected void Button1_Click(object sender, EventArgs e)
{
PageAsyncTask pat = new PageAsyncTask(BeiginGetDataAsync, EndDataRetrieveAsync, null, null);
Page.RegisterAsyncTask(pat);
}
IAsyncResult BeiginGetDataAsync(object sender, EventArgs e, AsyncCallback async, object extractData)
{
svc = new Service1Client();
return svc.BeginGetData(656,async, extractData);
}
void EndDataRetrieveAsync(IAsyncResult ar)
{
Label1.Text = svc.EndGetData(ar);
}
and in page directive added Async="true"
In this scenario it is working fine. But from UI i'm not supposed to call the service methods directly. I need to call all service methods from a static class and from code behind file i need to invoke the static method.
In this scenario what exactlly do i need to do?