basicasm-

You have your calls in the base of the class, you need to move it into
a method.  You should also put your "add event listener" into an
"onInit()" type of call.  Here's a quick example:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute" creationComplete="onInit()">
        <mx:Script>
    <![CDATA[
        import mx.rpc.events.FaultEvent;
        import net.webservicex.GetWeatherResultEvent;
        import net.webservicex.GlobalWeather;
      
        private var weather : GlobalWeather = new GlobalWeather;
      
        private function onInit():void {
          weather.addgetWeatherEventListener(handleWeather);
          weather.addGlobalWeatherFaultEventListener(onFault);
        }
        private function onClick():void {
          weather.getWeather("Spokane","United States");
        }
      
        private function handleWeather(e:GetWeatherResultEvent):void {
          trace(e.result.toString());
        }
      
        private function onFault(e:FaultEvent):void {
          trace("Fault: " + e.message);
        }
    ]]>
  </mx:Script>
  <mx:Button click="onClick()" label="Click Me" />
</mx:Application>


--- In [email protected], "basicasm" <[EMAIL PROTECTED]> wrote:
>
> I am trying to access a web service with Flex. So far I can import the
> WSDL just fine using the webservice import wizard. (File->Import->Web
> Service) But when I try to use one of the methods from the WSDL Flex
> tells me that I am trying to access an undefined property of the
service.
> 
> /* code
> 
>       import net.webservicex.BaseGlobalWeather;
>       import mx.rpc.events.ResultEvent;
>       import net.webservicex.GetWeatherResultEvent;
>       import net.webservicex.GlobalWeather;
> 
>       private var weather:GlobalWeather = new GlobalWeather;
> #     weather.getWeather("Spokane", "United States");
> #     weather.addgetWeatherEventListener(handleWeather);
>       private function handleWeather(event:ResultEvent):void
>       {
>        trace(event.result);
>       }
> */
> 
> The lines causing the problem are marked with '#'. You can view the
> WSDL that I am working with at
> http://www.webservicex.net/globalweather.asmx?wsdl
> 
> and I am trying to follow the example from http://www.flexlive.net/?p=79
> 
> Any help is appreciated, thank you.
>


Reply via email to