473,396 Members | 1,961 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Callback Question : Static Methods

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)

SecurityServiceWse wse=new SecurityServiceWse();
UsernameToken tkn = new UsernameToken(username, password,PasswordOption.SendHashed)
wse.RequestSoapContext.Security.Tokens.Add (tkn)

//Instantiate an AsyncCallback delegate to use as a paramete
//in the Begin method
AsyncCallback cb = new AsyncCallback(ProcessAsyncRequest.SecurityCallBack )

tr

// Begin the Async call to Web Service, passing in ou
// AsyncCalback delegate and a referenc
// to our instance of SecurityService
IAsyncResult ar = wse.BeginCustOrderHist(CustId, cb, wse)

catch(Exception ex

// Do something her


public static void SecurityCallBack(IAsyncResult ar
tr

SecurityServiceWse wse =(SecurityServiceWse)ar.AsyncState

string results

results=wse.EndCustOrderHist(ar)
catch(Exception ex

// do Somethin
}
}
Jul 21 '05 #1
2 1416
Have the static method update a static field with the result and access that static field with your instance.
Jul 21 '05 #2
Have the static method update a static field with the result and access that static field with your instance.
Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Adam | last post by:
If I catch an exception in a static callback method like: private static void ResponseCallback(IAsnycResult asyncResult) { try { //code...code...code } catch (WebException e) { //handle...
10
by: John Bowman | last post by:
Hello, I need some help getting a callback delegate passed as an argument to a dynamically linked Dll method so it in turn, can eventually call it. Below is the salient portions of code I'm...
0
by: Lenin | last post by:
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...
4
by: Dmitri Sologoubenko | last post by:
Hi, guys! I need a C++ class (Linux/POSIX/GNU C++), which can be started and stopped, and calls a virtual callback instance method (e.g. "expired()") when a given time has elapsed. High...
4
by: Jimmy | last post by:
I need to use Asynchronous Socket functions in a server application and am learning from sources such as the MSDN2 (http://msdn2.microsoft.com/en-us/library/bbx2eya8.aspx). What I observed is that...
6
by: JDT | last post by:
Hi, Can we pass a member function in a class as a callback function? Someone instucted me that I can only use a static functon or a global function as a callback. Your help is appreciated. JD
3
by: =?Utf-8?B?VG9tIEFsbGVu?= | last post by:
We are using a 3rd party API that processes video stream files to update a data structure in the file. I am writting a C# facade for this API but I am having a hard time getting it to pass data...
1
Airslash
by: Airslash | last post by:
Hello, I'm trying to make a simpel renderengine that allows me to draw objects and 3D models. To make it cross-platform i'm working with the glut library supplied by OpenGL. This library...
0
by: Tim Spens | last post by:
--- On Fri, 6/27/08, Tim Spens <t_spens@yahoo.comwrote: I think I know where the problem is but I'm unsure how to fix it. When I call Register_Handler(...) from python via...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.