473,396 Members | 1,917 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.

Problem with Asychronous Web Service Callback

Hi,

I am using this code to call a Web Service (from Amit Kalani's book) and
everything works except when that the ListBox referenced in the
WebServiceCallback method does not fill in the ListBox.

This is a really strange one because all the lines execute and I can see all
the values being assigned using Watches.

Here is the complete page code.

namespace WebAsync

{

/// <summary>

/// Summary description for WebServiceAsync.

/// </summary>

public class WebServiceAsync : System.Web.UI.Page

{

protected System.Web.UI.WebControls.Label Label1;

protected System.Web.UI.WebControls.TextBox txtCode;

protected System.Web.UI.WebControls.Button btnGetWeather;

protected System.Web.UI.WebControls.ListBox lbResults;
private void Page_Load(object sender, System.EventArgs e)

{

// This works

if(!IsPostBack)

lbResults.Items.Add("Hello");
}

#region Web Form Designer generated code

override protected void OnInit(EventArgs e)

{

//

// CODEGEN: This call is required by the ASP.NET Web Form Designer.

//

InitializeComponent();

base.OnInit(e);

}
/// <summary>

/// Required method for Designer support - do not modify

/// the contents of this method with the code editor.

/// </summary>

private void InitializeComponent()

{

this.btnGetWeather.Click += new
System.EventHandler(this.btnGetWeather_Click);

this.Load += new System.EventHandler(this.Page_Load);

}

#endregion

private void btnGetWeather_Click(object sender, System.EventArgs e)

{

com.capescience.live.AirportWeather aw = new
com.capescience.live.AirportWeather();

AsyncCallback wcb = new AsyncCallback(WebServiceCallback);

IAsyncResult ar = aw.BegingetSummary(txtCode.Text,wcb,aw);

ar.AsyncWaitHandle.WaitOne();

}

public void WebServiceCallback(IAsyncResult ar)

{

//This debugging line does not work either

lbResults.Items.Add("I'm back");
com.capescience.live.AirportWeather aw =
(com.capescience.live.AirportWeather) ar.AsyncState;

com.capescience.live.WeatherSummary ws = aw.EndgetSummary(ar);

lbResults.Items.Clear();
lbResults.Items.Add(ws.location);

lbResults.Items.Add(ws.wind);

lbResults.Items.Add(ws.sky);

lbResults.Items.Add(ws.temp);

lbResults.Items.Add(ws.humidity);

lbResults.Items.Add(ws.pressure);

lbResults.Items.Add(ws.visibility);
}

}

}


Nov 18 '05 #1
2 895
"Frank Mamone" <fr**********@canada.com> wrote in message
news:OL**************@TK2MSFTNGP09.phx.gbl...
Hi,

I am using this code to call a Web Service (from Amit Kalani's book) and
everything works except when that the ListBox referenced in the
WebServiceCallback method does not fill in the ListBox.

This is a really strange one because all the lines execute and I can see all the values being assigned using Watches.
....
//This debugging line does not work either

lbResults.Items.Add("I'm back");


Please define "does not work". Also, try Response.Write and see if that
works.

--
John Saunders
johnwsaundersiii at hotmail
Nov 18 '05 #2
John,

What I mean by does not work is that the lines execute but the ListBox does
not populate from the callback.

When I used Response.Write from the callback, only the Response statement
and the "I'm back" worked.

When I removed it and then put it back, the original symptoms occurred.

Thanks for your help,

Frank

"John Saunders" <jo**************@notcoldmail.com> wrote in message
news:ul**************@TK2MSFTNGP10.phx.gbl...
"Frank Mamone" <fr**********@canada.com> wrote in message
news:OL**************@TK2MSFTNGP09.phx.gbl...
Hi,

I am using this code to call a Web Service (from Amit Kalani's book) and
everything works except when that the ListBox referenced in the
WebServiceCallback method does not fill in the ListBox.

This is a really strange one because all the lines execute and I can see

all
the values being assigned using Watches.


...
//This debugging line does not work either

lbResults.Items.Add("I'm back");


Please define "does not work". Also, try Response.Write and see if that
works.

--
John Saunders
johnwsaundersiii at hotmail

Nov 18 '05 #3

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

Similar topics

1
by: VincentWong | last post by:
hi all, We're getting a security exception (An unhandled exception of type 'System.Security.SecurityException' occurred in mscorlib.dll) on a asychronous...
2
by: Stampede | last post by:
Hi guys 'n' girls, I want to use callback methods when using BeginInvoke on some events. So far no problem, but know I thought about what could happen (if I'm not completly wrong). Lets say an...
2
by: Veke | last post by:
I have attached web service behaviour control on may Label control and it worked fine, but when I've tryed the same thing on TextBox control it didn't work. It returned "error on page" message. Any...
4
by: Chris | last post by:
Hi, I found this web service http://www.webservicex.net/CurrencyConvertor.asmx This is my test code Dim test As New wsExchangeRate.CurrencyConvertor Dim testt As New...
2
by: Greg | last post by:
Please note: I have cross posted this from Newsgroup: microsoft.public.dotnet.framework.aspnet.webservices with a few minor changes... I am having a simple problem setting up the security on my...
1
by: leslie_tighe | last post by:
Hello, I have webservice created with Axis 1.2.1 and that I am trying to consuming in .NET (VB) using the Microsoft provided tools. While I am able to consume methods on the service that return...
1
by: SenthilVel | last post by:
Hi all i have a requirement in my application where in need to call a web service: 1. My client calls my webservice . 2. when i receive a call from my web servcie i need to notify my client...
1
by: =?Utf-8?B?S2F1c2hhbCBNZWh0YQ==?= | last post by:
Hi, Could you let me know what exactly happens when web service provider receives request from the client (from system perspective, like threading and all) ? Also, how does the web service...
0
by: iprogrammer | last post by:
i have a problem when i try to run my windows service ..which is "Error 1053: The service did not respond to the start or control request in a timely fashion" >after this i cannot anything with...
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...
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
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
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,...
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
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...
0
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,...

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.