Highlighted

Problem with inherited Objects

ArtistInClosure

31-03-2009

Hi,

I have a problem with inherited objects inside Flex using
wsdl as the source of the object. The AS-classes are generated
inside Flex Builder 3.



Inside the wsdl I have 2 complex types:



<complexType abstract="true" name="PersistentObject">

<sequence>

<element name="id" nillable="true" type="xsd:string"/>

<element name="insertTimeStamp" nillable="true"
type="xsd:dateTime"/>

<element name="insertUsername" nillable="true"
type="xsd:string"/>

<element name="updateTimeStamp" nillable="true"
type="xsd:dateTime"/>

<element name="updateUsername" nillable="true"
type="xsd:string"/>

</sequence>

</complexType>



and



<complexType name="Contact">

<complexContent>

<extension base="tns3:PersistentObject">

<sequence>

<element name="birthday" nillable="true"
type="xsd:dateTime"/>

<element name="firstName" nillable="true"
type="xsd:string"/>

<element name="lastName" nillable="true"
type="xsd:string"/>

<element name="middleName" nillable="true"
type="xsd:string"/>

<element name="newPassword" nillable="true"
type="xsd:string"/>

<element name="password" nillable="true"
type="xsd:string"/>

<element name="title" nillable="true"
type="xsd:string"/>

<element name="username" nillable="true"
type="xsd:string"/>

</sequence>

</extension>

</complexContent>

</complexType>



The classes in actionscript seem plausable:



public class PersistentObject

{

/**

* Constructor, initializes the type class

*/

public function PersistentObject() {}



public var id:String;

public var insertTimeStamp:Date;

public var insertUsername:String;

public var updateTimeStamp:Date;

public var updateUsername:String;

}



and



public class Contact extends PersistentObject

{

/**

* Constructor, initializes the type class

*/

public function Contact() {}



public var birthday:Date;

public var firstName:String;

public var lastName:String;

public var middleName:String;

public var newPassword:String;

public var password:String;

public var title:String;

public var username:String;

}



When I want to retreive an object of type Contact, it seems
that only a couple of entries are filled. While debugging the flex
XMLDecoder, I noticed something strange. It seems, like the decoder
is expecting the result xml data to be in alphabetical order:
birthday, firstname, lastname, etc. But since the object is
inherited, the data that is actually received contains elements
from the parent class: birthday, firstname, id, inserttimestamp,
...

The resulting object has just birthday and firstname filled,
which is somehow wrong. This seems to be a problem inside the
parser itself. What can I do?

Replies

Highlighted

churlbu

18-05-2009

I am having a problem with an extended class as well.

When I step through the code, everything is going fine and the decoder (mx.rpc.xml::XMLDecoder) sees that the class is an extension and wants to get the values for the superclass first.  When it gets into getApplicableValues(), it's looking for the values to be in the order of the definition which would be ok if the values collection didn't include the values from the subclass as well!  It goes through the whole definition and doesn't find anything for the superclass because the values aren't where it expects them.  When it pops back up to the subclass and starts to decode those values, it finds them because the definition order and values order match.

Is this a known issue?  Or, am I misunderstanding something?

Thanks,

Chuck

Highlighted

churlbu

22-05-2009

Has nobody really never seen anything like this before or should I have started a new thread?  I know in some forums replying to a thread with a similar but unrelated issue is frowned upon.

Thanks,

Chuck

Highlighted

thunq

12-06-2009

Focusing back on the original problem - passing more derived type objects as parameters to calls defined to take base classes - has anyone else had this problem or found a fix for it?  We're hitting this too.

Highlighted
Highlighted

churlbu

20-04-2010

I found another thread in the forum about this same problem last year after I posted my question (hence the question about not starting a new thread back then).  We had to re-work our classes to get things to work.  I'm not sure why somone from Adobe has not posted something one way or another.  Oh well.