PDA

View Full Version : How Do You Refresh a WebService?


gamerscalling
08-01-2007, 04:26 PM
I am trying to send new variables to my Web Service and update my page, but I have no clue how to have it refresh the information after the initial loading. I load in mxml but I want to refresh in AS. Or if need be I would be very happy to load it in AS too, I just don't know how...

Here is the code I have right now:

<mx:WebService id="wxService"
wsdl="http://www.weather.gov/forecasts/xml/SOAP_server/ndfdXMLserver.php?wsdl"
load="wxService.NDFDgen(lat, lon, 'glance', currentDay, lastDay, ['maxt=true', 'mint=true']);"
result="resultHandler(event)" />


Thank you!

gamerscalling
08-01-2007, 05:49 PM
Okay, I got my web service all in AS3 now.
But when I click my button I can not get it to get info from the web service. Any guidance would be greatly appreciated.

Here is my new code:

// Set Buttons to Fire
public function initApp():void {
lastDay.setTime(lastDay.getTime() + fiveDays);
refreshWx.addEventListener(MouseEvent.CLICK, refreshWxFunction);
wxService.addEventListener("result", resultHandler);
wxService.wsdl = "http://www.weather.gov/forecasts/xml/SOAP_server/ndfdXMLserver.php?wsdl";
wxService.loadWSDL();
wxService.NDFDgen.send(lat, lon, 'glance', currentDay, lastDay, ['maxt=true', 'mint=true']);
}

// Button Clicks
private function refreshWxFunction(event:Event):void {
lat = latInput.text as Number;
lon = lonInput.text as Number;
wxService.NDFDgen.send(lat, lon, 'glance', currentDay, lastDay, ['maxt=true', 'mint=true']);
trace("click");
}

dr_zeus
08-01-2007, 06:00 PM
In your original example, you called this code:

wxService.NDFDgen(lat, lon, ...

but in your second example, you call this code:

wxService.NDFDgen.send(lat, lon, ...

Do both methods work (with .send or without)?

gamerscalling
08-01-2007, 06:15 PM
Weird, that didn't make a difference either way... the .send works a little bit faster though.

But it was the lat and lon not getting sent as a number. Now it works all around.