You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by Michael Baird <mb...@kairyt.com> on 2013/04/11 19:52:32 UTC

[Flex-WCF] Complex type result ArrayCollection contains ArrayCollection

Hi,
I have a Flex 4.6 project communicating with .NET 4.5 through WCF
WebServices. I've been struggling with passing complex types from .NET to
Flex - they were always returning as ObjectProxy until I found this tip[1]
about using the SchemaTypeRegistry to map classes.

Now I have the root types returning correctly, but if the type contains a
List<T>, the first element is another ArrayCollection (or Array if I have *
makeObjectsBindable=false*). So I end up with:

result ->
    MyType
        listOfItems : ArrayCollection (correct)
            [0] ArrayCollection (extra - wrong)
                ItemA
                ItemB
                ...

This is what I am expecting:

result ->
    MyType
        listOfItems : ArrayCollection
            ItemA
            ItemB
            ...

The SOAP response is correct and doesn't contain the nested collection, so
I think it is something in the decoder. Is there a property or
configuration I can try to fix this?


[1]
http://www.patrick-heinzelmann.de/blog/2010/08/12/tips-and-tricks-to-use-soap-webservice-with-flex/

Re: [Flex-WCF] Complex type result ArrayCollection contains ArrayCollection

Posted by Michael Baird <mb...@kairyt.com>.
FYI for those who are looking for a solution... I fixed this by not
creating a default, empty ArrayCollection in my VO constructors/accessors.
Another tip (forgot link, sorry) indicated the decoder didnt know if it
should overwrite or fill an existing collection, so it chooses the latter.
If the collection is null, then it will set it directly.


On Thu, Apr 11, 2013 at 10:52 AM, Michael Baird <mb...@kairyt.com> wrote:

> Hi,
> I have a Flex 4.6 project communicating with .NET 4.5 through WCF
> WebServices. I've been struggling with passing complex types from .NET to
> Flex - they were always returning as ObjectProxy until I found this tip[1]
> about using the SchemaTypeRegistry to map classes.
>
> Now I have the root types returning correctly, but if the type contains a
> List<T>, the first element is another ArrayCollection (or Array if I have
> *makeObjectsBindable=false*). So I end up with:
>
> result ->
>     MyType
>         listOfItems : ArrayCollection (correct)
>             [0] ArrayCollection (extra - wrong)
>                 ItemA
>                 ItemB
>                 ...
>
> This is what I am expecting:
>
> result ->
>     MyType
>         listOfItems : ArrayCollection
>             ItemA
>             ItemB
>             ...
>
> The SOAP response is correct and doesn't contain the nested collection, so
> I think it is something in the decoder. Is there a property or
> configuration I can try to fix this?
>
>
> [1]
> http://www.patrick-heinzelmann.de/blog/2010/08/12/tips-and-tricks-to-use-soap-webservice-with-flex/
>