I have 2 major problems with the Flex (4.6) SoapDecoder, I really can’t get my head around.
The first major problem is that my ArrayCollection get decoded and inserted in the first item of the property instead of being the value of the property.
So I end up with a structure like
valueObject
|- children():ArrayCollection
|- [0] ArrayCollection
|- [0] SomeObject
|- [1] SomeObject
...
instead of the expected
valueObject
|- children():ArrayCollection
|- [0] SomeObject
|- [1] SomeObject
...
The second major problem I’m having, and this is the strange one, is that some objects don’t get their values assigned while others are.
eg. the Bar object has 2 properties with 2 objects
Bar
– foo():Foo
– tappas():Tappas
foo get it’s value perfectly while tappas remains empty.
Both objects are declared in the WSDL and registered in the SchemaTypeRegistry like this:
SchemaTypeRegistry.getInstance().registerClass(new QName("http://test.com/service","tappas"),Tappas);
SchemaTypeRegistry.getInstance().registerClass(new QName("http://test.com/service","foo"),Foo);
I spent 2 days already trying to get my head around this problem and I can’t find a decent explination.
Both my code (I’m using the SDK Webservice) as the WSDL seem fine to me.
I found it.
My theory is that when the Flex Soap decoder hits an element he doesn’t expect, it skips the entire definition and moves on.
It seems that the decoder starts decoding base classes and moves up from there.
When an element does not match the expected element from the WSDL, because the tag is missing in the response for example, the SOAP decoder skips decoding the rest and moves on with the the class it was originally working on.
for example:
WSDL:
If your respond looks like:
The property
Namewill be correctly set, butRaceandSoundwill not have been set by the decoder.Note that the
HouseTrained-property will be correctly set by the decoder, because when it ran into the missing tag in the base class, it stopped decoding there and continued with the rest of theDogclass.