Ah nice, thanks Valdor...

We're talking to SAP using HTTP Services so no AMF present.






2010/1/7 valdhor <valdhorli...@embarqmail.com>

>
>
> I don't use XML at all any more - I use typed objects via AMF. This cuts
> down the data traveling across the network significantly.
>
> I have multiple nested objects (I don't know whether nested is the right
> word - I have objects that contain other objects) being returned but I have
> not found it necessary to nest more than three levels so have not come
> across your problem.
>
> Tracy is the XML/e4x expert. When he has time, I'm sure he'll chime in.
>
>
> --- In flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>, Nick
> Middleweek <n...@...> wrote:
> >
> > Hey Valdor... Thanks for the tip there.
> >
> > Have you ever had problems receiving 4th level nested data from an HTTP
> > Service? We're trying to receive it as e4x or xml but it's coming back as
> > untyped Objects. I'm guessing this is a bug in the Flex framework...
> >
> >
> > Cheers,
> > Nick
> >
> >
> >
> >
> > 2010/1/6 valdhor <valdhorli...@...>
>
> >
> > >
> > >
> > > Nick
> > >
> > > Just for future reference...
> > >
> > >
> > > var myContact : ContactPerson = new ContactPerson();
> > > myContact = ContactPerson(myPerson);
> > >
> > > is a good example of how memory leaks occur. You create a new variable
> of a
> > > specific type and then allocate some memory for it with the new
> operator.
> > > The variable is just a pointer to a specific piece of memory. You then
> > > immediately change the pointer to point at another piece of memory. The
> > > original piece of memory that you allocated is now dangling with no way
> to
> > > access it and will need to wait on the garbage collector to reclaim it.
> > >
> > > The proper way to do what you are trying is:
> > >
> > > var myContact:ContactPerson = ContactPerson(myPerson);
> > >
> > >
> > > --- In flexcoders@yahoogroups.com 
> > > <flexcoders%40yahoogroups.com><flexcoders%
> 40yahoogroups.com>, Nick
>
> > > Middleweek <nick@> wrote:
> > > >
> > > > Hello...
> > > >
> > > > We've just run into a problem... Has anyone else come across this
> before?
> > > >
> > > > We're making HTTP Service calls and we're getting back nested data.
> We
> > > have
> > > > set the resultFormat="e4x" which we then parse into known Object
> types,
> > > such
> > > > a IContactData, IInvoiceDetails...
> > > >
> > > > The Problem: With some service calls, the data returned has 4 or more
> > > levels
> > > > of nested data. In these cases, Flex isn't giving us XML. It is just
> > > > returning an untyped Object with the nested data.
> > > >
> > > > If the returned data has 3 levels or less of nested data then we get
> XML.
> > > >
> > > >
> > > > We then thought, ok... The untyped Object returned by Flex does have
> all
> > > the
> > > > properties required to Cast it to our typed Object, e.g.
> IContactData...
> > > >
> > > > But we are getting a "Coercion failed" message by the Compiler.
> Here's a
> > > > basic example of the problem...
> > > >
> > > >
> > > > var myPerson : Object = new Object();
> > > > myPerson.age = "25";
> > > > myPerson.sex = "dunno"
> > > > myPerson.name = "Nick";
> > > >
> > > >
> > > > var myContact : ContactPerson = new ContactPerson();
> > > > myContact = ContactPerson(myPerson);
> > > > // Where ContactPerson is a typed Object with age, sex and name
> String
> > > > properties.
> > > >
> > > >
> > > >
> > > > So has anyone managed to solve the 4 levels of nested data problem
> from
> > > an
> > > > HTTP Service call?
> > > >
> > > > and :)
> > > >
> > > > Why can't we cast an untyped Object into a typed Object? :)
> > > >
> > > >
> > > > Cheers guys...
> > > >
> > > > Nick
> > > >
> > >
> >
>
>  
>

Reply via email to