Why Flex 3 Might Kill Your Web Services Powered Application
Do you have a Flex 2 or Flex 3 Beta 2 application with a SOAP based web services backend? If so, you might want to consider holding off upgrading to Flex 3 Beta 3 or the final version of Flex 3 (when it’s released).
If you do upgrade, you may notice that attributes on objects received in web service responses are not always present.
As a real world example, we were expecting to receive an object such as:
(Object)#0
isActive = false
id = 14
name = Salon7
Our server logs (and manual calling of the web service) showed that all the attributes were being sent, however, in Flex the object was received as:
(Object)#0
isActive = false
Obviously it’s not very helpful when two thirds of your object attributes go missing.
My colleague Jason filed bug #SDK-14194 over at the Flex bug tracker, and after some discussion it turns out that the way Flex handles certain SOAP elements changed between beta 2 and beta 3. Prior to beta 3, xsd:all elements (typically used in structuring complex objects, particularly those encoded by Ruby on Rails’ ActionWebService/SOAP4R), allowed child elements to appear in any order (as is valid according to the specs). However, Flex now erroneously treats xsd:all elements as xsd:sequence elements, requiring the child elements to arrive in the same sequence as they are specified in the WSDL file.
The current workaround is to ensure that you specify the element as an xsd:sequence and/or ensure that child elements arrive in the predefined order, but for those of you using third party web services or those backed by libraries/frameworks such as SOAP4R and Rails’ ActionWebService this might not be possible.
Unfortunately Svetlin Kalaydjiev of Adobe has stated that this bug won’t be fixed in time for the final Flex 3 release, but that it may be fixed some time after Flex is open sourced. I have filed enhancement request #SDK-14321 to request support for the xsd:all tag. If you are experiencing this problem it may be helpful if you provide Adobe with some input regarding your experiences.
For those of you using Rails’ ActionWebService, we have made some progress on a patch which ensures that xsd:all child elements arrive in the same order each time and will keep you posted if we produce a releasable patch.
