6 Replies Latest reply on Dec 5, 2008 10:01 AM by Newsgroup_User

    Parse webservice response in ResultEvent

    JZBAO Level 1
      I'm getting the Soap response from a weather webservice. I can see the XML string in the
      Soap body using Alert.show. But when I tried to retrieve the data inside the XML, I got nothing.

      [Bindable] private var xmlResult:XML;
      private function getResult(event:ResultEvent):void {
      xmlResult = new XML(event.result);
      Alert.show(xmlResult.toXMLString()); //This line shows the soap body. Please see below.
      var xml_list:XMLList = xmlResult.GetCityWeatherByZIPResult;
      Alert.show(xml_list.toXMLString()); //This line shows nothing.
      }

      I also tried {xmlResult..City}, but it returns nothing.

      This is what I see in the first Alert window:
      <GetCityWeatherByZIPResponse xmlns=" http://ws.cdyne.com/WeatherWS/" xmlns:soap=" http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd=" http://www.w3.org/2001/XMLSchema">
      <GetCityWeatherByZIPResult>
      <Success>true</Success>
      <ResponseText>City Found</ResponseText>
      <State>TX</State>
      <City>Huston</City>
      <WeatherStationCity>Huston</WeatherStationCity>
      <WeatherID>10</WeatherID>
      <Description>Mostly Sunny</Description>
      <Temperature>73</Temperature>
      <RelativeHumidity>42</RelativeHumidity>
      <Wind>SW9</Wind>
      <Pressure>29.78F</Pressure>
      <Visibility/>
      <WindChill>0</WindChill>
      <Remarks/>
      </GetCityWeatherByZIPResult>
      </GetCityWeatherByZIPResponse>