Idealism is what precedes experience; cynicism is what follows...

Thursday, September 27, 2007

Passing ArrayCollections between .NET and Flex

When using the Weborb communication server from MidnightCoders there is a shortcoming in regards to supporting serverside deserialization of ArrayCollections. It supports Arrays but when trying to send complex types containing a reference to a ArrayCollection it is necessary to add a classmapping manually.

If one tries to pass an ArrayCollection to the server it will throw an error and the client will handle it without explaining exactly what went wrong. Recieving lists and collections and have them deserialized on the client into an ArrayCollection is no problem, its just the other way around that is more complex.

You need to map the flex.messaging.io.ArrayCollection (ClientClass) to the omnipresent Weborb.Util.ObjectProxy (ServerClass).
This can be done wither through the management console (Typically the default webpage of the server) or via the weborb.config residing in the "bin" directory of the server.

Why they have ommitted this classmapping from the default configuration beats me, but the operation is very simple, so it should not pose a significant problem once acknowledged.

2 comments:

Mark Piller said...

Thanks for the post! We will update the default settings to make ArrayCollection serialization transparent.

Cheers,
Mark

Peter Andreas Molgaard said...

Sounds good, Mark... Im happy to be able to be of assistance. I will hence attempt to be extrovert from now about all my findings.

Cheers,
Peter

My Network