2 Replies Latest reply on Dec 18, 2006 10:27 AM by ctsteve

    TypeError: Error #1034: Type Coercion failed -

    ctsteve
      I am trying to take the results from a weather web service into a textbox and datagrid. I am getting an error -TypeError: Error #1034: Type Coercion failed -

      The error is below and my Flex app is below that. Thanks for any info on how to resolve this.

      ------------------------------------------------------------------------------------------ -----------------------------------------------------
      TypeError: Error #1034: Type Coercion failed: cannot convert "<GetWeatherByZipCodeResponse xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance" xmlns=" http://www.webservicex.net" xmlns:xsd=" http://www.w3.org/2001/XMLSchema" xmlns:soap=" http://schemas.xmlsoap.org/soap/envelope/">
      <GetWeatherByZipCodeResult>
      <Latitude>41.2976837</Latitude>
      <Longitude>73.49727</Longitude>
      <AllocationFactor>0.006599</AllocationFactor>
      <FipsCode>09</FipsCode>
      <PlaceName>RIDGEFIELD</PlaceName>
      <StateCode>CT</StateCode>
      <Details>
      <WeatherData>
      <Day>Monday, December 18, 2006</Day>

      --------------------------------------------------------------------------------------

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" xmlns="*" >
      <mx:Script>
      <![CDATA[
      private namespace webservicex = " http://www.webservicex.net/WeatherForecast.asmx?WSDL";
      use namespace webservicex;
      ]]>
      </mx:Script>
      <mx:WebService
      wsdl=" http://www.webservicex.net/WeatherForecast.asmx?WSDL"
      id="WS"
      useProxy="false"
      result="outputWS=WS.GetWeatherByZipCode.lastResult.toString()"
      >
      <mx:operation name="GetWeatherByZipCode" resultFormat="e4x" >
      <mx:request xmlns="webservicex">
      <ZipCode>
      {zipcode.text}
      </ZipCode>
      </mx:request>
      </mx:operation>
      </mx:WebService>
      <mx:Panel>
      <mx:TextArea id="outputWS" width="400" />
      <mx:Label text="please enter your zip code" />

      <mx:TextInput id="zipcode" />
      <mx:Button click="WS.GetWeatherByZipCode.send()" label="enter a zip code"/>
      <mx:Text text="day : {WS.GetWeatherByZipCode.lastResult.GetWeatherByZipCodeResult.Details.WeatherData[0].Day }" />
      <mx:DataGrid dataProvider="{WS.GetWeatherByZipCode.lastResult}" >
      <mx:columns>
      <mx:DataGridColumn dataField="GetWeatherByZipCodeResult.Details.WeatherData.Day" />
      </mx:columns>
      </mx:DataGrid>

      </mx:Panel>

      </mx:Application>
      ------------------------------------------------------------------------------------------ ---------