Odd that the "as" operator is not working correctly for you.  

 

I'd use the XML() syntax.  Having the type be XMLList when it is
actually an XML node might confuse someone some day. But its not my app.

 

Perhaps someone else will have some input on the data type issue

 

Tracy

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Mykola
Sent: Friday, March 21, 2008 3:23 PM
To: [email protected]
Subject: [flexcoders] Re:Help binding an XML file from a webservice?

 

Hi Tracy,

I don't really want to disagree with you, but it is a technical issue
and I see some difference in what you said and my code results. Maybe
you will know the answer. 

> E4x event.result is XML. 

I am actually getting xml (lowercase) type, not XML type. When I run
typeof on my event.result: 

trace("result type: " + (typeof event.result));

I am getting this line in the log:

result type: xml 

For some reason, it is lowercase xml type.

If event.result is XML, then casting of event.result to XML should
work, right? For some reason, it does not really work:

var xmlres:XML = event.result as XML;
trace("xml result: " + xmlres); 

# flashlog.txt contains:
xml result: null

Why am I getting null? 

By the way, if I cast it to XMLList, I am getting an object that is
not null. 

var xmllstres:XMLList = event.result as XMLList;
trace("xmllstres result: " + xmllstres);

# flashlog.txt contains:
xmllstres result: <m:getProductsResponse
xmlns:m="http://org/wssample/service <http://org/wssample/service> "
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/
<http://schemas.xmlsoap.org/soap/envelope/> ">
<m:return xmlns:java="java:org.wssample.product">
<java:ProductDetails>
<java:ModelName>Blue-Ray DVD Player</java:ModelName>
<java:ModelNumber>BPL051</java:ModelNumber>
</java:ProductDetails>
...

I can wrap event.result in XML object and it gives me an object that
is similar to xmllstres.

var xmlres2:XML = XML(event.result);
trace("xml result 2: " + xmlres2); 

# flashlog.txt contains:
xml result 2: <m:getProductsResponse
xmlns:m="http://org/wssample/service <http://org/wssample/service> "
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/
<http://schemas.xmlsoap.org/soap/envelope/> ">
<m:return xmlns:java="java:org.wssample.product">
<java:ProductDetails>
<java:ModelName>Blue-Ray DVD Player</java:ModelName>
<java:ModelNumber>BPL051</java:ModelNumber>
</java:ProductDetails>

Once again, I did not mean to disagree with what you said. I just want
to clarify things.

Thank you,
- Mykola

--- In [email protected] <mailto:flexcoders%40yahoogroups.com>
, "Tracy Spratt" <[EMAIL PROTECTED]> wrote:
>
> E4x event.result is XML. But the division between XML and XMLList is
> blurred, since most XML methods will work on an XMLList that has only
a
> single node.
> 
> 
> 
> Tracy
> 
> 
> 
> ________________________________
> 
> From: [email protected] <mailto:flexcoders%40yahoogroups.com>
[mailto:[email protected] <mailto:flexcoders%40yahoogroups.com>
] On
> Behalf Of Mykola Dzyuba
> Sent: Friday, March 21, 2008 2:40 AM
> To: [email protected] <mailto:flexcoders%40yahoogroups.com> 
> Subject: [flexcoders] Re:Help binding an XML file from a webservice?
> 
> 
> 
> Hi, 
> 
> 
> 
> Your code looks mostly right. Just a couple of updates. You need to
> define namespaces as you see in your SOAP response. Also, it might be
> different in your case, but I think event.result in e4x mode is
XMLList,
> not XML. Can you add this line to your handleGetSpecies method to see
> the actual type?
> 
> 
> 
> trace("result type: " + (typeof event.result));
> 
> 
> 
> Somebody asked a similar question a couple of days ago. You might want
> to check this post:
> 
> 
> 
> http://tech.groups.yahoo.com/group/flexcoders/message/106748
<http://tech.groups.yahoo.com/group/flexcoders/message/106748> 
> <http://tech.groups.yahoo.com/group/flexcoders/message/106748
<http://tech.groups.yahoo.com/group/flexcoders/message/106748> > 
> 
> 
> 
> - Mykola
>

 

Reply via email to