473,382 Members | 1,400 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,382 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 1415
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.