Re: [Spam] RE: [SPAM] [flexcoders] Re: Problem Casting an Object to a known type

2010-01-16 Thread Tino Dai
Hey Nick,

 Maybe this would work, maybe not. Could try zip the data on the SAP
side and then unzip on the flex side. If some some reason, there is a
problem with the AMF transfer, it might avoid it. Just a though.

-Tino


On Fri, Jan 8, 2010 at 11:43 AM, Nick Middleweek n...@middleweek.co.ukwrote:



 Thanks for the reply Tracy...

 I am using mx:WebService, not HTTP Service, my mistake :)


 I'll keep you all posted with progress..


 Cheers,
 Nick




 2010/1/8 Tracy Spratt tr...@nts3rd.com



  Yeah, I really suspect the problem is on the server side.  I don’t
 recall specifically using 4 or more levels of xml, but I would be very
 surprised if the e4x implementation had a problem like that.  You plan to
 test it is a good one.



 A question: You say you are HTTPService, but are also using SOAP?  SOAP is
 typically used with WebService calls.  Are you manually building a SOAP
 message and then sending it using the HTTPService protocol?  Is the SAP web
 service layer is a standard SOAP web service implementation, why are you not
 using WebService?





 Tracy Spratt,

 Lariat Services, development services available
   --

 *From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] *On
 Behalf Of *bhaq1972
 *Sent:* Friday, January 08, 2010 4:44 AM
 *To:* flexcoders@yahoogroups.com
 *Subject:* [SPAM] [flexcoders] Re: Problem Casting an Object to a known
 type





 Hi Nick
 If the returned object has 3 nested levels its xml but if it 4 nested
 levels its not?

 Do you use flexbuilder debugger? It might be worth putting a breakpoint at
 the point where you return from the httpserviceand examining it. It
 might not be a object which can be typecasted to ContactPerson().

 Are you sure its a Compiler error or was it a Runtime error?

 Bodrul

 --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Nick
 Middleweek n...@... 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
 


  



[flexcoders] Re: Problem Casting an Object to a known type

2010-01-08 Thread bhaq1972
Hi Nick
If the returned object has 3 nested levels its xml but if it 4 nested levels 
its not?

Do you use flexbuilder debugger? It might be worth putting a breakpoint at the 
point where you return from the httpserviceand examining it. It might not 
be a object which can be typecasted to ContactPerson().

Are you sure its a Compiler error or was it a Runtime error?


Bodrul












--- In flexcoders@yahoogroups.com, Nick Middleweek n...@... 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





RE: [SPAM] [flexcoders] Re: Problem Casting an Object to a known type

2010-01-08 Thread Tracy Spratt
Yeah, I really suspect the problem is on the server side.  I don't recall
specifically using 4 or more levels of xml, but I would be very surprised if
the e4x implementation had a problem like that.  You plan to test it is a
good one.

 

A question: You say you are HTTPService, but are also using SOAP?  SOAP is
typically used with WebService calls.  Are you manually building a SOAP
message and then sending it using the HTTPService protocol?  Is the SAP web
service layer is a standard SOAP web service implementation, why are you not
using WebService?

 

 

Tracy Spratt,

Lariat Services, development services available

  _  

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of bhaq1972
Sent: Friday, January 08, 2010 4:44 AM
To: flexcoders@yahoogroups.com
Subject: [SPAM] [flexcoders] Re: Problem Casting an Object to a known type

 

  

Hi Nick
If the returned object has 3 nested levels its xml but if it 4 nested levels
its not?

Do you use flexbuilder debugger? It might be worth putting a breakpoint at
the point where you return from the httpserviceand examining it. It
might not be a object which can be typecasted to ContactPerson().

Are you sure its a Compiler error or was it a Runtime error?

Bodrul

--- In flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com ups.com,
Nick Middleweek n...@... 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






Re: [Spam] RE: [SPAM] [flexcoders] Re: Problem Casting an Object to a known type

2010-01-08 Thread Nick Middleweek
Thanks for the reply Tracy...

I am using mx:WebService, not HTTP Service, my mistake :)


I'll keep you all posted with progress..


Cheers,
Nick




2010/1/8 Tracy Spratt tr...@nts3rd.com



  Yeah, I really suspect the problem is on the server side.  I don’t recall
 specifically using 4 or more levels of xml, but I would be very surprised if
 the e4x implementation had a problem like that.  You plan to test it is a
 good one.



 A question: You say you are HTTPService, but are also using SOAP?  SOAP is
 typically used with WebService calls.  Are you manually building a SOAP
 message and then sending it using the HTTPService protocol?  Is the SAP web
 service layer is a standard SOAP web service implementation, why are you not
 using WebService?





 Tracy Spratt,

 Lariat Services, development services available
   --

 *From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] *On
 Behalf Of *bhaq1972
 *Sent:* Friday, January 08, 2010 4:44 AM
 *To:* flexcoders@yahoogroups.com
 *Subject:* [SPAM] [flexcoders] Re: Problem Casting an Object to a known
 type





 Hi Nick
 If the returned object has 3 nested levels its xml but if it 4 nested
 levels its not?

 Do you use flexbuilder debugger? It might be worth putting a breakpoint at
 the point where you return from the httpserviceand examining it. It
 might not be a object which can be typecasted to ContactPerson().

 Are you sure its a Compiler error or was it a Runtime error?

 Bodrul

 --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Nick
 Middleweek n...@... 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
 
   



[Spam] [flexcoders] Re: Problem Casting an Object to a known type

2010-01-07 Thread valdhor
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, 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, 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
  
 





Re: [Spam] [Spam] [flexcoders] Re: Problem Casting an Object to a known type

2010-01-07 Thread Nick Middleweek
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.comflexcoders%
 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
   
  
 

  



[Spam] [Spam] [flexcoders] Re: Problem Casting an Object to a known type

2010-01-07 Thread valdhor
What does SAP run on? Java?

Is there no way to add some kind of middleware like WebORB?

--- In flexcoders@yahoogroups.com, Nick Middleweek n...@... wrote:

 Ah nice, thanks Valdor...
 
 We're talking to SAP using HTTP Services so no AMF present.
 
 
 
 
 
 
 2010/1/7 valdhor valdhorli...@...
 
 
 
  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 nick@ 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 valdhorlists@
 
  
   
   
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.comflexcoders%
  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

   
  
 
   
 





Re: [Spam] [Spam] [Spam] [flexcoders] Re: Problem Casting an Object to a known type

2010-01-07 Thread Nick Middleweek
No, SAP is SAP. It's a beast of a German system.

We're talking directly to it's Web Service layer.




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



 What does SAP run on? Java?

 Is there no way to add some kind of middleware like WebORB?




[Spam] [Spam] [Spam] [flexcoders] Re: Problem Casting an Object to a known type

2010-01-07 Thread valdhor
A little bit of research shows that there are a number of connectors out 
there...

PHP:
http://it.toolbox.com/blogs/php-sap-dev/getting-started-with-php-and-sap-8354
http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/12898

Java:
http://help.sap.com/saphelp_nw04/helpdata/en/6f/1bd5c6a85b11d6b28500508b5d5211/content.htm

.NET:
https://media.sdn.sap.com/html/submitted_docs/dotnet/Programming%20with%20PDK%20for%20.NET/Connecting%20to%20SAP%20NetWeaver%20Systems/Using%20SAP%20.NET%20Connector.htm

--- In flexcoders@yahoogroups.com, Nick Middleweek n...@... wrote:

 No, SAP is SAP. It's a beast of a German system.
 
 We're talking directly to it's Web Service layer.
 
 
 
 
 2010/1/7 valdhor valdhorli...@...
 
 
 
  What does SAP run on? Java?
 
  Is there no way to add some kind of middleware like WebORB?
 
 





[Spam] [flexcoders] Re: Problem Casting an Object to a known type

2010-01-07 Thread Amy


--- In flexcoders@yahoogroups.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...

Have you verified that the deeply nested data is actually properly formatted 
XML?  For instance, when you're having SQL Server make  XML for you, you 
sometimes need to cast the results of subqueries to XML.

HTH;

Amy



Re: [Spam] [Spam] [flexcoders] Re: Problem Casting an Object to a known type

2010-01-07 Thread Nick Middleweek
Hi Amy,

Mm... What is a way of verifying the returned data is valid XML?

It 'looks' ok, but are there tools to check it, I mean it's valid in terms
that it looks formatted correctly...


Thanks,
Nick



2010/1/7 Amy amyblankens...@bellsouth.net





 --- 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...

 Have you verified that the deeply nested data is actually properly
 formatted XML? For instance, when you're having SQL Server make XML for you,
 you sometimes need to cast the results of subqueries to XML.

 HTH;

 Amy





[Spam] [Spam] [flexcoders] Re: Problem Casting an Object to a known type

2010-01-07 Thread Amy


--- In flexcoders@yahoogroups.com, Nick Middleweek n...@... wrote:

 Hi Amy,
 
 Mm... What is a way of verifying the returned data is valid XML?
 
 It 'looks' ok, but are there tools to check it, I mean it's valid in terms
 that it looks formatted correctly...

Try calling the service from a web browser. Most of them will tell you if it is 
malformed, and you'll see things like lt; instead of , etc.

HTH;

Amy



Re: [Spam] [Spam] [Spam] [flexcoders] Re: Problem Casting an Object to a known type

2010-01-07 Thread Nick Middleweek
Hi Amy,

I can't use a browser cause I need to send it a SOAP request, I'll have a
hunt for WSDL/ SOAP tester or explorer...

Perhaps there's a plugin for Eclipse?...



Thanks agan..
N


2010/1/7 Amy amyblankens...@bellsouth.net





 --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Nick
 Middleweek n...@... wrote:
 
  Hi Amy,
 
  Mm... What is a way of verifying the returned data is valid XML?
 
  It 'looks' ok, but are there tools to check it, I mean it's valid in
 terms
  that it looks formatted correctly...

 Try calling the service from a web browser. Most of them will tell you if
 it is malformed, and you'll see things like lt; instead of , etc.

 HTH;

 Amy




[Spam] [Spam] [Spam] [flexcoders] Re: Problem Casting an Object to a known type

2010-01-07 Thread valdhor
Copy and paste the XML to a file and then try opening the file in a browser.

--- In flexcoders@yahoogroups.com, Nick Middleweek n...@... wrote:

 Hi Amy,
 
 I can't use a browser cause I need to send it a SOAP request, I'll have a
 hunt for WSDL/ SOAP tester or explorer...
 
 Perhaps there's a plugin for Eclipse?...
 
 
 
 Thanks agan..
 N
 
 
 2010/1/7 Amy amyblankens...@...
 
 
 
 
 
  --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Nick
  Middleweek nick@ wrote:
  
   Hi Amy,
  
   Mm... What is a way of verifying the returned data is valid XML?
  
   It 'looks' ok, but are there tools to check it, I mean it's valid in
  terms
   that it looks formatted correctly...
 
  Try calling the service from a web browser. Most of them will tell you if
  it is malformed, and you'll see things like lt; instead of , etc.
 
  HTH;
 
  Amy
 
 





[Spam] [Spam] [Spam] [flexcoders] Re: Problem Casting an Object to a known type

2010-01-07 Thread Amy


--- In flexcoders@yahoogroups.com, valdhor valdhorli...@... wrote:

 Copy and paste the XML to a file and then try opening the file in a browser.

That might not show problems like lt;, since those may well be masked by 
toString() or toXMLString().  Just sayin...

Amy



[flexcoders] Re: Problem Casting an Object to a known type

2010-01-06 Thread valdhor
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, Nick Middleweek n...@... 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





Re: [Spam] [flexcoders] Re: Problem Casting an Object to a known type

2010-01-06 Thread Nick Middleweek
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...@embarqmail.com



 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, Nick
 Middleweek n...@... 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