Peter, You are right, the Map data is actually coming back intact; it is the debug console output that is omitting the data. So there's no problem here except that the trace output is erroneous.
I'm not coercing anything to a String; the output you see is what one normally sees when running the Flash Player in debug mode with AMF logging enabled. I rely on these printouts a lot for debugging. I guess the AMF tracing code built into the player doesn't handle this case properly. Thanks much for your assistance, . . . . ...j Peter Farland wrote: > Are you coercing the Array to a String (say, via simple concatenation) > in a trace()? Perhaps associative Array keys aren't shown when > "toString" in Flash... can you try a for in loop instead? Or as a quick > test do trace(result["key1"]). > > The conversion of Map -> ECMA Array is a legacy behavior from Flash > Remoting that we should consider making configurable in the next release > of Flex as people would like to be able to do Map -> Object since it is > a more useful type (associative arrays doesn't behave much like an > Array) and allows you do use dot-syntax. Note that Map keys are > "toString"'ed too as per the requirements for AMF / AS2 types. > > > > > -----Original Message----- > From: [email protected] [mailto:[EMAIL PROTECTED] On > Behalf Of Joe Berkovitz > Sent: Friday, May 20, 2005 1:59 PM > To: [email protected] > Subject: [flexcoders] deserializing Maps with AMF (RemoteObject) > > I can't for the life of me seem to pass a java.util.Map back from a > RemoteObject call. The data comes back as an empty array object ([]) > rather than as an untyped object. > > Anyone encountered this problem? > > I have tried return-typing the method as HashMap and Object as well, no > dice in any case. > > Here is my remote method that is being invoked: > > public Map test3() > { > HashMap map = new HashMap(); > map.put("key1", "val1"); > map.put("key2", "val2"); > return map; > } > > > Server trace looks like this: > > Info: Processing batch of 1 request(s) > Info: Requesting target 'testServer.test3' > Info: Service 'com.allurent.arcx.test.TestServer' sent to adapter 'Java > Class Adapter' > Info: Completed 'testServer.test3' with reply method 'onResult' in 10ms > Info: Serializing response > (Message #0 targetURI=/2/onResult, responseURI=null) > (ECMA Array #0) > key1 = "val1" > key2 = "val2" > > Client trace looks like this: > > [trace] 5/20 12:40:52 [INFO] RemoteObject_AMF: Invoking test3 on > testServer > [trace] 5/20 12:40:52 [INFO] RemoteObject_AMF: testServer.test3() > returned [] // where's my data, dude? > > > > > Yahoo! Groups Links > > > > > > > > > > Yahoo! Groups Links > > > > > > > > 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/

