I don't want to cause too big a stir, but this kind of situation is pretty common when you mix a loosely typed Collection object such as a Map with cross-language serialization and dynamic class loading (the gateway has to use Java reflection to load the object, traverse the object map, etc). Then when you get the Map, how will you type cast the Java object into AS?
I guess what I am getting at here is, I would avoid such loosely typed Collection objects for passing across the wire. Can you create your own Java class to hold the values and return a more traditional Value Object rather then a Map? -- Dave Wolf Cynergy Systems, Inc. Macromedia Flex Alliance Partner http://www.cynergysystems.com Email: [EMAIL PROTECTED] Office: 866-CYNERGY --- In [email protected], "jgraham_us" <[EMAIL PROTECTED]> wrote: > > public static var regClass = > Object.registerClass("testuser.Test", views.testuser.Test); > > Thats the actual line. I just made a mistake when typing in the > psuedo code below. > > The weird part is, if I build the Object on the client side and send > it across to the server it appears to work. > > I can look at the objects in the debugger and compare them and I > can't see any difference between them. > > Is there a way to figure out more details as to which object it is > failing on when sending back to the server? > > The error message is not very detailed, I get two different errors > on the client side. > > One is an error about converting the input type, and the other is it > was expecting type testuser.Test but was trying to send > flashgateway.io.ASObject. > > Thanks > > --- In [email protected], "Peter Farland" <[EMAIL PROTECTED]> > wrote: > > > > Can you double check your usage of Object.registerClass? > > > > Object.registerClass("testuser.Test","Test"); > > > > Should be > > > > Object.registerClass("testuser.Test", Test); > > > > > > -----Original Message----- > > From: [email protected] > [mailto:[EMAIL PROTECTED] On > > Behalf Of jgraham_us > > Sent: Thursday, December 15, 2005 2:25 PM > > To: [email protected] > > Subject: [flexcoders] Re: passing Map from Flex to server side > > > > Going from server to client appears to be working fine. My server > > classes do not implement Map or Collection. I have tried very > simple > > cases, and the Maps are not empty. > > > > Here is an example. > > > > Test.java > > ------------------------------------------------------ > > package testuser; > > > > public class Test{ > > > > Map<String, User> users; > > > > Map<String, User> getUsers() { > > ... > > } > > > > void setUsers(Map<String, Users> users) { > > ... > > } > > > > } > > ------------------------------------------------------- > > > > Test.as > > ------------------------------------------------------- > > class Test > > { > > Object.registerClass("testuser.Test","Test"); > > > > var users : Array; > > > > ... > > } > > > > So are you saying that my object on the server side, users must be > of > > type ASObject, or do I have to implement some intermediate type > then > > build my server side Test object from this intermediate type that > is an > > ASObject? > > > > Basically I need to get the Test object on the client side possibly > > update it and then send that same object back and have it be a Test > > (server side object) when I get it back on the server. > > > > Thanks > > --- In [email protected], "Peter Farland" <[EMAIL PROTECTED]> > > wrote: > > > > > > > > > Note that while you can register classes using ActionScript on > the > > > client for serialization... there's no way to "register" a Java > > class on > > > the server. Your server type must not implement Map or Collection > > as > > > these types already have firm rules for server to client > > serialization. > > > > > > This may be something to log for consideration for Flex 2.0. > > > > > > > > > Alternatively, any chance are you returning empty Maps in any of > > the > > > properties? > > > > > > I ask because the following special case may occur: > > > > > > Empty Java Map -> Empty AS Associative Array -> Empty Java List > > > > > > This is because there's no distinction between an empty dense, > > ordinal, > > > i.e. normal AS Array and an empty AS Associative Array (i.e. > > they're the > > > thing, just an empty Array) and thus Array -> List. > > > > > > I'd contact Flex Support if you need a solution to the latter for > > Flex > > > 1.5. We've worked with customers on this problem. > > > > > > (NB: After several customer requests, Flex 1.5 reverted back to > > match > > > the legacy behavior from Flash Remoting's convention of returning > > a Java > > > Map as an associative Array instead of an Object... which > > historically > > > stems from ColdFusionStructs being return as AS Associative > Arrays > > > (...and note Flex 1.0 had Maps returned as Objects). > > > > > > In Flex 2.0 we've again moved to have Java Maps returned as AS > > Objects > > > by default (with a configuration option for people who wish to go > > back > > > to the old Arrays... but note this something that we would > > discourage in > > > Flex 2.0 due to the issue described above). > > > > > > > > > > > > > > > -----Original Message----- > > > From: [email protected] > > [mailto:[EMAIL PROTECTED] On > > > Behalf Of jgraham_us > > > Sent: Thursday, December 15, 2005 12:23 PM > > > To: [email protected] > > > Subject: [flexcoders] passing Map from Flex to server side > > > > > > Using remote objects stuff, I am able to pass my object which > > contains a > > > Map object from server to flex, but when I try to send that > object > > > back it doesn't work. > > > > > > Set objects work, but Map objects don't. > > > > > > > > > On the AS side my Map is defined as an Array in the AS object. > > > > > > On the server side it is a Map object. > > > > > > I have a registerClass call to map the AS object to the java > > object. > > > > > > Can anyone help me out or point me to any examples of how to do > > this? > > > > > > Thanks > > > > > > > > > > > > > > > > > > > > > ------------------------ Yahoo! Groups Sponsor ------------------ > -- > > ~--> > > > Most low income homes are not online. Make a difference this > > holiday > > > season! > > > http://us.click.yahoo.com/5UeCyC/BWHMAA/TtwFAA/nhFolB/TM > > > ----------------------------------------------------------------- > -- > > -~-> > > > > > > -- > > > Flexcoders Mailing List > > > FAQ: > > http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > > > Search Archives: > > > http://www.mail-archive.com/flexcoders%40yahoogroups.com > > > Yahoo! Groups Links > > > > > > > > > > > > > > > > > ------------------------ Yahoo! Groups Sponsor -------------------- > ~--> > > 1.2 million kids a year are victims of human trafficking. Stop > slavery. > > http://us.click.yahoo.com/.QUssC/izNLAA/TtwFAA/nhFolB/TM > > ------------------------------------------------------------------- > -~-> > > > > -- > > Flexcoders Mailing List > > FAQ: > http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > > Search Archives: > > http://www.mail-archive.com/flexcoders%40yahoogroups.com > > Yahoo! Groups Links > > > ------------------------ Yahoo! Groups Sponsor --------------------~--> Fair play? Video games influencing politics. Click and talk back! http://us.click.yahoo.com/2jUsvC/tzNLAA/TtwFAA/nhFolB/TM --------------------------------------------------------------------~-> -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 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/

