Flex 3.0 Introspecting Utility: Handling Collections Bug

By M&S Consulting (Ashwin) on Jun 8th, 2009
Filed Under Technical Tips // Tags: , ,

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. Dynamic forms and dependent dropdowns in Flex I had the age-old requirement today to build a data-driven, dynamic form…only this time with my RIA written in Adobe...
  2. Modular Flex Development - Multiple SWFs I have been tasked with coming up with a modularized approach for logically separating out an extensive Flex application I...
  3. BlazeDS: Introduction and Installation BlazeDS is a java-based remoting and messaging technology that allows web-clients to connect to back-end distributed data easily. BlazeDS creates...
  4. Applications with SQL Maintained Outside of Stored Procedures I have seen multiple custom solutions and packaged applications store their SQL outside of stored procedures. I am focusing this...
  5. BPA 10.1.3.4 Windows Install with XE I have just had a heck of a time with installing BPA (Architect) Evaluation on a Windows Server 2003 machine....

Leave a Reply


Archives

Recent Comments

  • SaintClair said: Thanks a million for this priceless material. May God richly bless you!
  • ashok.aggarwal said: Thank you for your comment, Stuart. I’m glad this helped you.
  • Stuart said: I’d really like to thank you for your post. It was really that simple.
  • ashok.aggarwal said: Your specific question is not very clear, however, in the context of implementing a LIKE...
  • Jonas said: Finally in print that a user is required to show the email option. Thanks.

Calendar

March 2010
M T W T F S S
« Feb    
1234567
891011121314
15161718192021
22232425262728
293031  

Featured Testimonial

"M&S has taken 'partnership' to a new level. They are not only a deeply skilled service provider, the M&S team is actually a mission critical component to our operations, taking on new initiatives as well as maintaining custom, open source, and COTS solutions."

CEO, MedPivot

Free SQL Service