ya basically...  flex deseirializes the soap objects an untyped AS2 Object tree.

load the tree manually into you class heirachy with a load function in your as2 objects

here's an example of what i mean... just look @ the load func

might want to ignore all the event code you probably won't need it


import mx.events.*;
class com.ibm.g3.model.bo.Team
{   
    public  var vo:Object = undefined;
    private var origVO:Object = undefined; //concurenccy (future)
     
    // ----------------- this code is to dispatch events ---------------------
    public function Team()
    {       
        EventDispatcher.initialize(this);
        this.vo = new Object();       
        this.origVO = new Object();
    }
   
    public var addEventListener:Function;
    public var removeEventListener:Function;
    private var dispatchEvent:Function;
   
    // ------------------ end event dispatch code ------------------
   
    [ChangeEvent("change")]
    public function get teamId():Number{return vo.teamId;}
    public function set teamId(v:Number){vo.teamId = v; dispatchEvent({ type: "change" });}
    [ChangeEvent("change")]
    public function get dashBoard():Boolean{return vo.dashBoard;}
    public function set dashBoard(v:Boolean){vo.dashBoard = v; dispatchEvent({ type: "change" });}
    [ChangeEvent("change")]
    public function get ibmRfpName():String{return vo.ibmRfpName;}
    public function set ibmRfpName(v:String){vo.ibmRfpName = v; dispatchEvent({ type: "change" });}
    [ChangeEvent("change")]
    public function get gmRfpName():String{return vo.gmRfpName;}
    public function set gmRfpName(v:String){vo.gmRfpName = v; dispatchEvent({ type: "change" });}
    [ChangeEvent("change")]
    public function get UserDetailTree():Array{return vo.UserDetailTree;}
    public function set UserDetailTree(v:Array){vo.UserDetailTree = v; dispatchEvent({ type: "change" });}
           
    public var hasData:Boolean = false;
   
    //    the reason for this load() function is to extract the webservice result into this object because
    //    we can't assign the webservice result directly to any instance of this class (it will over-write it)
   
    public function load(u:Object)
    {
        //for concurency later
        this.oldVO = u;

        //load the object                       you could use mx.utils.ObjectUtil.copyProperties here
        this.teamId         = u.teamId;
        this.dashBoard      = u.dashBoard;
        this.ibmRfpName        = u.ibmRfpName;
        this.gmRfpName        = u.gmRfpName;
        this.gmRfpName        = u.gmRfpName;
        // the line below isn't really what i want to do here with this data
        //this.UserDetailTree    = u.UserDetailTree;
        //this is what we should do
        for(var i = 0; i < u.UserDetailTree.length)
        {
               var userDetail:UserDetail = new UserDetail();
               userDetail.load(u.UserDetailTree[i]);
        }
        //not very pretty i realise but it works
        hasData = true;
    }
   
    public function toString():String
    {
        return this.ibmRfpName + " - " + this.gmRfpName;
    }
}





On 6/17/05, cgobble <[EMAIL PROTECTED]> wrote:
I thought I had resolved the problem by creating classes in
ActionScript where the collections are specifically designed as
Arrays.  The problem seems to be how Flex determines if an object is
an array or not when it reads the message from the web service.
Depending on how I set it up, the problem can appear to be on either
the Flex side, or the .Net side.  It's interesting that I can set up
a complex class structure that works in Flex with all of the
appropriate methods, properties and arrays and it translates to the
web service just fine.  But, when I try to fill my classes with the
result from the web service, it doesn't recognize the elements and
instantiate the appropriate class.  I must be missing something
fundamental.

Cliff


--- In [email protected], Clint Modien <[EMAIL PROTECTED]> wrote:
> Is your problem on the flex side or on the .NET side?
>
>
> On 6/16/05, Matt Chotin <[EMAIL PROTECTED]> wrote:
> >
> >  Hmm, seems odd. Can you take a look at the object in a debugger
and see
> > if it's constructed the way you'd expect? Also turn on debugging
> > (web-service-proxy) and check if we're even sending the phone
number across
> > the wire. If not you may need to "re-process" the contact before
executing
> > the send to make sure that things are what the web service
expects.
> >
> >  Matt
> >
> >   ------------------------------
> >
> > *From:* [email protected]
[mailto: [email protected]] *On
> > Behalf Of *cgobble
> > *Sent:* Wednesday, June 15, 2005 9:51 AM
> > *To:* [email protected]
> > *Subject:* [flexcoders] Re: Collections between Flex and Web
services
> >
> >  I am using the mx.utils.ArrayUtil.toArray to bind to a
datagrid.
> > This makes sure that Flex sees it when there is only 1 item in
the
> > array. However, going back to the service with the entire object
is
> > causing the problem. I've been experimenting with defining
classes
> > for these objects and I get the same problem when I use an array.
> >
> >
> >
> > --- In [email protected], "Matt Chotin" <[EMAIL PROTECTED]>
> > wrote:
> > > Check out mx.utils.ArrayUtil.toArray(). You may need to call
that
> > to
> > > make sure that when you pass a single item it still gets
treated
> > as an
> > > array.
> > >
> > >
> > >
> > > Matt
> > >
> > >
> > >
> > > ________________________________
> > >
> > > From: [email protected]
> > [mailto:[email protected]] On
> > > Behalf Of cgobble
> > > Sent: Wednesday, June 15, 2005 7:36 AM
> > > To: [email protected]
> > > Subject: [flexcoders] Collections between Flex and Web services
> > >
> > >
> > >
> > > Hello,
> > >
> > > I'm trying to return complex types with collections from a web
> > > service and everything seems to work fine. But, when I send
the
> > > type as the input parameter for the web service, if there is
only
> > 1
> > > item in the collection it does not get back to the web service.
> > >
> > > For instance, you have a Contact object in a dotnet web
service.
> > > The Contact has a collection of phone numbers. I simply want
to
> > > pass the entire Contact object back and forth between the web
> > > service and Flex.
> > > I create a method on the web service such as: (VB)
> > >
> > > Public Sub SaveContact(Contact as Contact)
> > >
> > > End Sub
> > >
> > > However, it seems that if I only have 1 phone number, the
phone
> > > number gets lost in translation, even though the Contact info
> > comes
> > > back correctly. I was able to partially fix this by making
sure
> > my
> > > collections were instantiated in the constructor, but if I
nest a
> > > collection, it doesn't seem to work right.
> > >
> > > Any ideas??
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > ________________________________
> > >
> > > Yahoo! Groups Links
> > >
> > > * To visit your group on the web, go to:
> > > http://groups.yahoo.com/group/flexcoders/
> > >
> > > * To unsubscribe from this group, send an email to:
> > > [EMAIL PROTECTED]
> > > <mailto: [EMAIL PROTECTED]?
> > subject=Unsubscribe>
> > >
> > > * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> > > Service <http://docs.yahoo.com/info/terms/> .
> >
> >
> >
> >
> > ------------------------------
> > *Yahoo! Groups Links*
> >
> >    - To visit your group on the web, go to:
> >    http://groups.yahoo.com/group/flexcoders/
> >    - To unsubscribe from this group, send an email to:
> >    [EMAIL PROTECTED]<flexcoders-
[EMAIL PROTECTED] >
> >    - Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> >    Service <http://docs.yahoo.com/info/terms/>.
> >
> >






Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/







Yahoo! Groups Links

Reply via email to