6 Replies Latest reply on Apr 26, 2010 11:07 AM by AnilKrc

    Problem with inherited Objects

      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">
      <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"/>


      <complexType name="Contact">
      <extension base="tns3:PersistentObject">
      <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"/>

      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;


      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?