One issue with dynamic objects is the speed of access compared to
strongly typed value objects.  It is usually only an issue if you have
large numbers of item renderers on screen.  In that case, accessing
values from dynamic objects or even XML nodes (which are essentially
dynamic) is significantly *noticably* slower than  accessing strongly
typed objects.  (I personally have not had this issue, but search the
archives for many posts)

 

The consensus of opinion seems to be to get the data as e4x XML, without
the conversion (there is a performance penalty incurred to convert the
xml into that tree of objects).  Then, process the xml manually,
building an array collection of strongly typed value objects.

 

Now, that is pretty clear if you have a straightforward list of items,
but if you data is hierarchical, it might not be so clear.  Note: I have
not used the hirearchical collection view.

 

So the default tree is the "worst of both worlds"  you take the
conversion hit, you have the dynamic object access hit, and you do not
get the awesome e4x expression API.

 

Tracy

 

________________________________

From: [email protected] [mailto:[email protected]] On
Behalf Of weezee49
Sent: Wednesday, December 17, 2008 7:26 PM
To: [email protected]
Subject: [flexcoders] Re: data returned from WSDL call

 

Thanks, that's the ticket. <mx:WebService> doesn't have a
resultFormat attribute, but <mx:operation> does. Setting the
operations' resultFormat to "e4x" gave me XML back. I also had to
play around with the result to get past the outer layers. It involved
the following:

var xmlResultList:XMLList = event.result as XMLList
var xmlResult:XML = xmlResultList[0]
trace(xmlResult.children())

However, with that said, I'm finding it's actually easier to deal with
the tree of dynamic objects. I found something under the comments
about the DataGrid object that explains how to handle the return
result as either an ObjectProxy or an ArrayCollection. For my
purposes turning an ObjectProxy (if that's what I got) into an
ArrayCollection and then processing the ArrayCollection is working
better than digging through the XML structure. 

I'm curious to know why you said that going straight to an
ArrayCollection is rarely desirable. Can you give me more info on
your reasoning behind that?

Thanks!
LG Rains

--- In [email protected] <mailto:flexcoders%40yahoogroups.com>
, "Tracy Spratt" <tspr...@...> wrote:
>
> Have you set resultFormat="e4x"? If not, you are not working with xml.
> Flex has generated a tree of dynamic objects. Though it allows you to
> go straight to an arrayCollection, this format is rarely desirable.
> 
> 
> 
> Set the resultFormat, then in your result handler do:
> 
> var xmlResult = event.result as XML;
> 
> trace(xmlResult.toXMLString);
> 
> 
> 
> You will see your xml as flex sees it.
> 
> 
> 
> Be aware that you may have xml namespace issues accessing the nodes
via
> e4x expressions. Google, check archives and see the docs for help with
> this.
> 
> 
> 
> Tracy
> 
> 
> 
> ________________________________
> 
> From: [email protected] <mailto:flexcoders%40yahoogroups.com>
[mailto:[email protected] <mailto:flexcoders%40yahoogroups.com>
] On
> Behalf Of Louise Rains
> Sent: Wednesday, December 17, 2008 9:28 AM
> To: [email protected] <mailto:flexcoders%40yahoogroups.com> 
> Subject: [flexcoders] data returned from WSDL call
> 
> 
> 
> I'm getting data back from a wsdl call that looks like this:
> 
> 
> 
> <?xml version="1.0" encoding="windows-1252"?> <ns0:ROOT
> xmlns:ns0="urn:AMAT_Asset_KeyGen" xmlns:xsd="
> 
> http://www.w3.org/2001/XMLSchema <http://www.w3.org/2001/XMLSchema>
<http://www.w3.org/2001/XMLSchema <http://www.w3.org/2001/XMLSchema> > "
> xmlns:xsi="
> 
> http://www.w3.org/2001/XMLSchema-instance
<http://www.w3.org/2001/XMLSchema-instance> 
> <http://www.w3.org/2001/XMLSchema-instance
<http://www.w3.org/2001/XMLSchema-instance> > ">
> 
> <ns0:getListValues>
> 
> <ns0:B_License_Key>0200362</ns0:B_License_Key>
> 
>
<ns0:B_Warranty_End_Date>2007-03-31T00:00:00-04:00</ns0:B_Warranty_End_D
> ate>
> 
> 
> 
> <ns0:Company_Name>SOME COMPANY</ns0:Company_Name>
> 
> <ns0:Part_Number>ALFLSS3300-1400</ns0:Part_Number>
> 
> <ns0:Product_Category>PER</ns0:Product_Category>
> 
> <ns0:Product_Type>AUTOMOD</ns0:Product_Type>
> 
> <ns0:Quantity>1.000000</ns0:Quantity>
> 
> <ns0:Site_Name>SOME SITE</ns0:Site_Name>
> 
> </ns0:getListValues> 
> 
> ...
> 
> <ns0:ROOT>
> 
> 
> 
> If I have multiple <getListValues> returned, I can use an
> ArrayCollection and step through each object in the collection to get
> the data. However, I'm having a hard time determining the type of
> event.result in the case where there is only one <getListValues>
object
> returned. When I trace event.result, I get [object Object]. If I try
> to cast it to XML, XMLList or ArrayCollection, I get null objects. 
> 
> 
> 
> Is there a way to use reflection to determine what the [object Object]
> really is? How can I access the data that's coming back?
> 
> 
> 
> Thanks!
> 
> 
> 
> LG Rains
>

 

Reply via email to