Flex 3.0 Introspecting Utility: Handling Collections Bug



Even Flex Builder with all its awesomeness is not without its own set of quirks. It seems the introspecting utility does not handle collections(arrays, arraylist, string[]) properly.

My Example Problem and Solution

Following is a simple example:

  • I had written a java webservice that takes a Array of a custom object and loads it to the database.
  • I tested the webservice by itself and it worked.
  • I used the Flex Builder’s Introspecting utility to integrate my Flex Application with my webservice.
  • I had added the client side code to invoke the webservice with the appropriate data and tested it.
  • It failed miserably.

The problem was with the objects that Flex sent to the webservice. After long hours of debugging, I noticed that the objects I had received in my service, even though a collection, were serialized in a format Java was unable to understand. They were objects, but i was unable to cast or convert them.

I decided to modify my Java webservice to accept a String[], as I assumed my problem was with a collection of objects. I modified my client application to convert all the data in the model to a colon-delimited-string and passed a String[] to my webservice.

This is when the real problem showed itself; I noticed that in my webservice all strings in the arrays were concatenated into one huge ‘comma-delimited-string’. After realizing what the introspecting utility was doing to the String[], I just had to make some minor modifications to the webservice to get it to work.

Conclusion

There is still a problem with Arrays of Custom Objects. Please check the ‘Adobe Bug Database’ to see related bugs. For now, the only work around as i see it would be to use BlazeDS for your webservice integration. It is a middle-layer for your environment, it externalizes the webservice connections, and has a better messaging framework as well as more feature. I feel it is a good choice, even if Adobe does fix this issue.

Bookmark and Share

Related Information:

  1. Flex Builder 3 Download – Where’s the link?
    It is now more difficult...
  2. Flex 4 & FlashBuilder Impressions – Catalyst, FXG, Spark Components
    This past week I was...
  3. Modular Flex Development – Multiple SWFs
    I have been tasked with...
  4. Dynamic forms and dependent dropdowns in Flex
    I had the age-old requirement...
  5. Flex on Android – Nexus One Mobile Device
    I just can’t wait for...
  6. Adobe
    Adobe Flex M&S Consulting has...
  7. Oracle Enterprise Manager (EM) 11g – Adobe AIR Desktop Widgets
    I like seeing Oracle leverage...
  8. SSIS Tip – Read from Variables to Rows in Data Flow using Script Task
    Reading from variables to augment...

Leave a Reply