473,748 Members | 10,539 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP.Net with Asynchronous Web Service calls

Hi
I have asked a similar question on the web services discussion group, but the question is a bit more related to ASP.Net. Basically I have a ASP.Net application that calls a web service asynchronously. This is fine. My problem is that when I make a call to the web service asynchronously when I get the return which is passed into a static method I cannot reference any Web Contorls to paste the return values into from within the static method.

I have been advised to create a static field and add the value retuned to the static methos to the static field which should be referenceable from all methods. Again fine.

However my question is how do I then tell the cntrol that will display my returned value to pick it up?

A typical sequence would b

1. Client makes async call. Passes in static methos name to send the results to on completion
2. browser can do wor
3. static method picks up result,
4. needs to tell asp.net to now pick up the result and show it

point 4 is my problem

Any help appreciated
Nov 18 '05 #1
8 2303
You need to have your static method be part of a class, and create an event
in the class. In your ASP.NET routine, attach a delegate (handler) to the
event, and raise it when you have the results.

"Trotsky" <an*******@disc ussions.microso ft.com> wrote in message
news:9D******** *************** ***********@mic rosoft.com...
Hi,
I have asked a similar question on the web services discussion group, but the question is a bit more related to ASP.Net. Basically I have a
ASP.Net application that calls a web service asynchronously. This is fine.
My problem is that when I make a call to the web service asynchronously when
I get the return which is passed into a static method I cannot reference any
Web Contorls to paste the return values into from within the static method.
I have been advised to create a static field and add the value retuned to the static methos to the static field which should be referenceable from all
methods. Again fine.
However my question is how do I then tell the cntrol that will display my returned value to pick it up??
A typical sequence would be

1. Client makes async call. Passes in static methos name to send the results to on completion. 2. browser can do work
3. static method picks up result,
4. needs to tell asp.net to now pick up the result and show it.

point 4 is my problem.

Any help appreciated.

Nov 18 '05 #2
Many thanks Ricky. Are you aware of any useful ( msdn ) references for this
Nov 18 '05 #3
Not for this specific case, but you might want to prowl around for general
information about delegates and events.

"Trotsky" <an*******@disc ussions.microso ft.com> wrote in message
news:34******** *************** ***********@mic rosoft.com...
Many thanks Ricky. Are you aware of any useful ( msdn ) references for this?

Nov 18 '05 #4
Thanks again. I had a go at this. However I have came across another issue. My app now does the followin

1. Creates a class ( AsynCall.cs ) that takes care of the asynchronous web services call, and raising of events when the result is returned from the web service
2. passes a reference from the .aspx.cs class ( this ) to the AsynCall object. This is because the .aspx.cs class will be listening for the reslt when it is available from the Asyn web services call
3. The AsynCall class defines an event that is raised when the asynchronous call returns. The .aspx.cs class has a method that matches the method definition defined by a delegate in AsyncCall.cs, and has registered its method with the handler
4. The aync result is returned and the appropriate event is raised, I can write to debug to check I am in the correct aspx.cs class and the correct result has been returned from the web service call
5. When I try to then write the result to a label on the form nothing appears.

point 5 is my problem

again any help greatly appreciated
Nov 18 '05 #5
The page isn't being reloaded just because the event occurs. You might have
to force this - try saving the result from the web service in session state,
(or adding it to your page's URL as a query string) and then do a
server.transfer back to the same page, pick up the value and put it into
your control. (I haven't tried this <g>)

"Trotsky" <an*******@disc ussions.microso ft.com> wrote in message
news:68******** *************** ***********@mic rosoft.com...
Thanks again. I had a go at this. However I have came across another issue. My app now does the following
1. Creates a class ( AsynCall.cs ) that takes care of the asynchronous web services call, and raising of events when the result is returned from the
web service. 2. passes a reference from the .aspx.cs class ( this ) to the AsynCall object. This is because the .aspx.cs class will be listening for the reslt
when it is available from the Asyn web services call. 3. The AsynCall class defines an event that is raised when the asynchronous call returns. The .aspx.cs class has a method that matches the
method definition defined by a delegate in AsyncCall.cs, and has registered
its method with the handler. 4. The aync result is returned and the appropriate event is raised, I can write to debug to check I am in the correct aspx.cs class and the correct
result has been returned from the web service call. 5. When I try to then write the result to a label on the form nothing appears.
point 5 is my problem.

again any help greatly appreciated.

Nov 18 '05 #6
I tried your suggestion ( and also a simple redirect to a new page ) from my method in the original aspx.cs class that matches the delegates required signature, but nothing happened ( on the Page, it still logs to the debug window that it is in the correct method )
Nov 18 '05 #7
I went through the stack trace and for a redirect it ( the aspx page ) throws an exception stating

"Response is not available in this context

For the Server.Transfer I get "Error executing child request for". MSDN recommends redirect.

http://support.microsoft.com/default...kb;en-us;32043

Regardless both fail
The annoying this is when I look in the locals window I can see the result returned from the web service is assigned to the label control on the form. It just isn't reflected in the browser window.
Nov 18 '05 #8
i have a similar problem, i can see the result in the debug view but the result does not get displayed on the web page

Any solution

Thanks. Karim.
Nov 18 '05 #9

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

Similar topics

5
4824
by: Marty McDonald | last post by:
I create and start several threads, each thread executes the same method - within the method, a web service is invoked. I find that the more threads I use, the longer it takes for all of the threads to finish. The threads are asynchronous, correct? And I thought each would be able to use it's own version of the web service. Am I wrong, does the web service force only one thread at a time to execute? Here is code if interested... I'm...
0
1552
by: orekinbck | last post by:
Hi There This question is about calling an asynchronous web service from the UI thread. Unless I am making a fundamental error, it appears that the asynchronous web service call seems to spark off an Application.DoEvents() when system resources are low and the message loop has queued requests. Here are some snippets of code to describe the problem:
0
1672
by: Jonathan Trevor | last post by:
Hi, I've found what appears to be a bug with ASP.NET web service method invocation - making it impossible to invoke and get the result of a synchronous web call after an asynchronous call has been made if both are using sessions. Heres an example for two calls in the web service, the first is expected to be executed asynchronously by the client and the second to get the progress of the first while it is executing:
1
9846
by: Alexander Kaplunov | last post by:
I have two different scenarios: 1. I have an application that calls a web service and passes an object. Web Service takes that object and does some stuff with it, which could take some time. It seems to me that in this case it would be appropriate to use asynchronous web service. Am I correct?
5
4605
by: rgarf | last post by:
I have a C++ application that consumes a web service. I would like to call the web service asynchronously so my C++ application can do other processing in between. My proxy file does not have any asynchronous methods in it, What do I have to do to get my proxy file to have the asynchronous methods to call? Thanks
5
4377
by: SenthilVel | last post by:
Hi Can any one let me know how i can perform a Asychronous calll in a web service ? or using a thread in Asmx a better solution than the async call ? pls send me any link to example, where i can get this answer.. Thanks
0
1240
by: Ken T. | last post by:
I have questions regarding what happens on the web server side during an asynchronous web method call when the client aborts its request via .Abort() call. Background: My client app asynchronously calls a web method in a "broker" web service that I've written. My broker service method in turn synchronously calls another web service to perform backend processing. This second, synchronous call can take up to a minute to return. My...
7
6315
by: jtbjurstrom | last post by:
Bear with me because we are new to WCF and have been going through documentation and samples trying to absorb as much as possible in a short amount of time. Any suggestions would be much appreciated. We would of course rather start off on the right path instead of learning later that there's a much better and easier solution, but get stuck with our original implementation. We are working on designing a client server solution using WCF...
1
3042
by: jan.loucka | last post by:
I'm developing WinForms application in .NET 2.0 that talks to web service. The automatically generated proxy (reference class) has got methods for both synchronous and asynchronous invocations of the web service methods. What I like about the asynchronous calls that they use events. So when I call the web service operation is finished is fires the event. So all my objects that I'm using in my client application just subscribe to whatever...
1
1774
by: jan.loucka | last post by:
I'm developing WinForms application in .NET 2.0 that talks to web service. The automatically generated proxy (reference class) has got methods for both synchronous and asynchronous invocations of the web service methods. What I like about the asynchronous calls that they use events. So when I call the web service operation is finished is fires the event. So all my objects that I'm using in my client application just subscribe to whatever...
0
8991
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8831
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9374
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9325
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9249
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8244
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4607
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4876
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.