0 Replies Latest reply on Nov 6, 2011 3:58 AM by ran.haim

    Flex Soap decoding

    ran.haim

      Hi,

      there seems to be a problem in flex soap deoding (has been in 3.0 and now I see it is still in 4.5).

       

      When the server returns an array of objects (soap type is anyType) then flex doesnt try to find the type of each of the objects inside the array,

      and it creates them as objectProxy instead of the real type (types are custom types).

       

      The problem is in the SOAPArrayType.as decodeArrayItem.

      I have created a new Class that is excetly the same where the only difference is the decodeArrayItem function:

       

      private function  decodeArrayItem(parent:*, value:*):void

                    {

                        var decoder:SOAPDecoder = processor as SOAPDecoder;

       

                        if(value is XML)

                        {

                                  // this is the only diffrence in this class.

                                  // caculate the type of every item and do not

                                  // depend on the type of the array

                                  var valueXML:XML = value as XML;

                                  if (valueXML != null)

                                  {

                                            var tempTypeString:String = valueXML.@[schemaConstants.typeAttrQName];

                                            var tempschemaType:QName = schemaManager.getQNameForPrefixedName(tempTypeString, valueXML)

                                            var item:* = decoder.createContent(tempschemaType);

                                            decoder.decodeType(tempschemaType, item, itemName, value);

                                            decoder.setValue(parent, itemName, item, tempschemaType);

                                  }                                                       

                              }else

                              {                 

                                  var item:* = decoder.createContent(schemaType);

                                  decoder.decodeType(schemaType, item, itemName, value);

                                  decoder.setValue(parent, itemName, item, schemaType);

                              }

                    }

       

       

      Also another problem is that all of the custom types generated by the flash builder are not registered in the SchemaTypeRegistry (in 3.0 web services generation, a code would be generated that will register all of the custom types) and I have to do it by myself,

      otherwise all of the objects returned will be ObjectProxy.

       

      Is this a huge bug or am I doing something wrong?