Hi
I have a quick question regarding static methods as part of a callback mechanism ( with particular reference to a web service, although it is not a web service question ). Basically I have an asp.net form which makes a call to a web service asynchronously ( below ). My prroblem is that in order for the processing to occur asynchronously I have to create a static method to pass to the asynch call. The results are then available in the method once processing has completed. I need then to get the value from the static method to a label on the asp.net. Given that the static method is part of the class and the lable object is part of an instance of the class I have an issue. Can someone help me resolve this please
public static void go(String CustId, string username, string password)
SecurityService Wse wse=new SecurityService Wse();
UsernameToken tkn = new UsernameToken(u sername, password,Passwo rdOption.SendHa shed)
wse.RequestSoap Context.Securit y.Tokens.Add (tkn)
//Instantiate an AsyncCallback delegate to use as a paramete
//in the Begin method
AsyncCallback cb = new AsyncCallback(P rocessAsyncRequ est.SecurityCal lBack)
tr
// Begin the Async call to Web Service, passing in ou
// AsyncCalback delegate and a referenc
// to our instance of SecurityService
IAsyncResult ar = wse.BeginCustOr derHist(CustId, cb, wse)
catch(Exception ex
// Do something her
public static void SecurityCallBac k(IAsyncResult ar
tr
SecurityService Wse wse =(SecurityServi ceWse)ar.AsyncS tate
string results
results=wse.End CustOrderHist(a r)
catch(Exception ex
// do Somethin
}
}
I have a quick question regarding static methods as part of a callback mechanism ( with particular reference to a web service, although it is not a web service question ). Basically I have an asp.net form which makes a call to a web service asynchronously ( below ). My prroblem is that in order for the processing to occur asynchronously I have to create a static method to pass to the asynch call. The results are then available in the method once processing has completed. I need then to get the value from the static method to a label on the asp.net. Given that the static method is part of the class and the lable object is part of an instance of the class I have an issue. Can someone help me resolve this please
public static void go(String CustId, string username, string password)
SecurityService Wse wse=new SecurityService Wse();
UsernameToken tkn = new UsernameToken(u sername, password,Passwo rdOption.SendHa shed)
wse.RequestSoap Context.Securit y.Tokens.Add (tkn)
//Instantiate an AsyncCallback delegate to use as a paramete
//in the Begin method
AsyncCallback cb = new AsyncCallback(P rocessAsyncRequ est.SecurityCal lBack)
tr
// Begin the Async call to Web Service, passing in ou
// AsyncCalback delegate and a referenc
// to our instance of SecurityService
IAsyncResult ar = wse.BeginCustOr derHist(CustId, cb, wse)
catch(Exception ex
// Do something her
public static void SecurityCallBac k(IAsyncResult ar
tr
SecurityService Wse wse =(SecurityServi ceWse)ar.AsyncS tate
string results
results=wse.End CustOrderHist(a r)
catch(Exception ex
// do Somethin
}
}
Comment