I looked back at the code that shipped with that gateway and I see the issue. (Note that I couldn't reproduce this locally so it means that we've fixed this for the next release... not that this really helps you right now).
FYI, to create an ECMA array on the client in AS you just create an Array with named keys (i.e. it's an Array that doesn't have dense, ordinal keys). An ECMA array at runtime is essentially just like an Object (but without the dot-syntax for key resolution)... but they're different AMF types and thus have deserialization code. The ECMA code is being deserialized as a CaseInsensitiveMap as per Flash Remoting MX 1.0 but it must not be tied into the configuration setting at this step. The object case does not have this issue. This isn't a great work around but if your gateway build version (as per the number listed in the the MANIFEST.MF file as 1.X.XXXXX) is build 88733 or later, try setting this on your map before using it in your echo()... map.useCaseInsensitivity(false); -----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Alon J Salant Sent: Friday, May 27, 2005 3:54 PM To: [email protected] Subject: [flexcoders] Flash Remoting bug in Map handling Hey all, This is both an FYI and a query to see if anyone has a solution to this issue. There seems to be a bug in Flash Remoting in the handling of java.util.Map keys. Setup: Flex 1.5 Remoting configured with <serialization>Flex</serialization> <lowercase-keys>false</lowercase-keys> The issue is that Map keys are always made lowercase. The issue appears to be in the deserializing of objects of type 'ECMA Array' coming from Flash. To reproduce create a Java service: public class RemotingService { public Map getMap() { Map map = new HashMap(); map.put("Uppercase Key", "value"); return map; } public Object echo(Object obj) { return obj; } } Using these services in Flex to reproduce this bug as follows: 1. Call getMap() to get the map instance from the server 2. trace the map keys - the key will still be mixed case 3. Call echo() with the map as argument 4. trace the returned map keys - the key will be all lowercase It seems to me that the Map contents should be able to round trip without modification. Turning on debugging in the gateway, I you can see that the type of the map is 'ECMA Array'. There doesn't seem to be a way to create an ECMA Array in ActionScript. You can only get one back from a Remoting call. I need my Map key case to be preserved. The only workaround for this issue I can think of is to clone the Map contents into an ActionScript object before sending it back to the server: var clone = {}; for (var p in map) { clone[p] = map[p]; } This does work - the gateway debugging shows that this is now of type 'Object' which correctly becomes a Map with key case preserved in Java. Anyone got any better ideas? Alon alon at carbonfive.com 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/

