Adobe Dreamweaver Forums



Last 10 THreads :         Using AS3 tile list to load video? (Last Post : wendydnew - Replies : 0 - Views : 1 )           »          How to have button in down state as page opens (Last Post : designut - Replies : 2 - Views : 7 )           »          Conditional loop (Last Post : pkonshak - Replies : 0 - Views : 1 )           »          debugger causing browser to crash (Last Post : ntsiii - Replies : 1 - Views : 2 )           »          ADOBE - Forum search is broken (Last Post : Ansury - Replies : 0 - Views : 1 )           »          Adobe Flex 3 with AIR Certification Exam is Now Out !!! (Last Post : Greg Lafrance - Replies : 2 - Views : 3 )           »          Please point me to the correct topic section of thisForum (Last Post : dzedward - Replies : 1 - Views : 2 )           »          Editing spry menu in Contribute (Last Post : thephillykid - Replies : 1 - Views : 13 )           »          CF8 Help in Dreamweaver CS3 (Last Post : danilocelic AdobeCommunityExpert - Replies : 3 - Views : 4 )           »          Library is missing names from splitter bar (Last Post : Murray *ACE* - Replies : 1 - Views : 2 )           »         


Home Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
User Info Statistics
Go Back   Adobe Dreamweaver Forums > Other Macromedia/Adobe Products > Flex
 
Tags:



Reply
  #1 (permalink)  
Old 12-05-2008, 12:02 AM
JZBAO
 
Posts: n/a
Diggs:
Default Parse webservice response in ResultEvent

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/envelo pe/"
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>



Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 12-05-2008, 01:24 AM
Amy Blankenship
 
Posts: n/a
Diggs:
Default Re: Parse webservice response in ResultEvent


"JZBAO" <webforumsuser@macromedia.com> wrote in message
news:gh9qro$qv3$1@forums.macromedia.com...
> 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.
> }


http://www.magnoliamultimedia.com/fl...s_Flex_FAQ.pdf
Q14


Reply With Quote
  #3 (permalink)  
Old 12-05-2008, 04:03 AM
JZBAO
 
Posts: n/a
Diggs:
Default Re: Parse webservice response in ResultEvent

I changed my code a little bit:

[Bindable] private var xmlResult:XML;
private function getResult(event:ResultEvent):void {
xmlResult = new XML(event.result);
Alert.show(xmlResult.toXMLString());
var xml:XML = xmlResult.GetCityWeatherByZIPResult[0];
Alert.show(xml.toXMLString()); //This line throws null point exception.
}

The Debugger shows xml is null.
Why the dot notation is not working here.

Amy, I tried your suggestion in FAQ, but it does not help.

Reply With Quote


  #4 (permalink)  
Old 12-05-2008, 05:03 AM
JZBAO
 
Posts: n/a
Diggs:
Default Re: Parse webservice response in ResultEvent

I hard coded

[Bindable] private var xmlResult:XML=
<GetCityWeatherByZIPResponse
xmlns="http://ws.cdyne.com/WeatherWS/"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelo pe/"
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>Houston</City>
<WeatherStationCity>Houston</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>;

I found it is because e4x can not correctly parse the first line:

<GetCityWeatherByZIPResponse xmlns="http://ws.cdyne.com/WeatherWS/"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelo pe/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">

Bug or virus in my FB3?

Reply With Quote
  #5 (permalink)  
Old 12-05-2008, 02:13 PM
Amy Blankenship
 
Posts: n/a
Diggs:
Default Re: Parse webservice response in ResultEvent


"JZBAO" <webforumsuser@macromedia.com> wrote in message
news:gha8po$e45$1@forums.macromedia.com...
>I changed my code a little bit:
>
> [Bindable] private var xmlResult:XML;
> private function getResult(event:ResultEvent):void {
> xmlResult = new XML(event.result);
> Alert.show(xmlResult.toXMLString());
> var xml:XML = xmlResult.GetCityWeatherByZIPResult[0];
> Alert.show(xml.toXMLString()); //This line throws null point exception.
> }
>
> The Debugger shows xml is null.
> Why the dot notation is not working here.
>
> Amy, I tried your suggestion in FAQ, but it does not help.


Clearly not, since you are _still_ trying to reference the root node (which
is already the same thing as xmlResult). Try reading it again for
comprehension.

HTH;

Amy


Reply With Quote
  #6 (permalink)  
Old 12-05-2008, 04:42 PM
JZBAO
 
Posts: n/a
Diggs:
Default Re: Parse webservice response in ResultEvent

I tried both

var xml:XML=xmlResult.City and xmlResult..City

Neither of them worked. Both gave xml = null in Debugger.
Reply With Quote


  #7 (permalink)  
Old 12-05-2008, 06:02 PM
Amy Blankenship
 
Posts: n/a
Diggs:
Default Re: Parse webservice response in ResultEvent


"JZBAO" <webforumsuser@macromedia.com> wrote in message
news:ghblih$8up$1@forums.macromedia.com...
>I tried both
>
> var xml:XML=xmlResult.City and xmlResult..City
>
> Neither of them worked. Both gave xml = null in Debugger.


Try this:
http://dispatchevent.org/roger/using...ur-namespaces/

HTH;

Amy


Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



© Camley Interactive (camley.info) 2008 - all logos and images are copywrite their respective owners.
Proud member of the Camley Interactive Network
All times are GMT. The time now is 06:39 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
Cheap Car Insurance - Compare Motor Insurance
Endsleigh Car Insurance Natwest Car Insurance
More Than Car Insurance Norwich Union Car Insurance
Prudential Car Insurance Zurich Car Insurance
Inactive Reminders By Mished.co.uk