I have a dynamic Class that is a Value Object that is used to pass arguments to a WebService. It has two public properties:
package { [Bindable] public dynamic class WebServiceCriteria { public var property1:String; public var property2:String; } }
I set these two properties in one part of my application:
var myCriteria:WebServiceCriteria = new WebServiceCriteria(); myCriteria.property1 = 'x'; myCriteria.property2 = 'y';
Then I added other – dynamic – properties at another point in my application:
myCriteria.property3 = 'z';
However, when I pass the instance to the WebService as the arguments, the original two public properties are not sent (as I can see in Fiddler), even though they have values. But, I can see them as properties of my Class instance in the debugger just prior to the send().
operation.arguments = {args: myCriteria}; operation.send(); // only property3 is sent
Why are those two properties not sent?
Here is an example of the SOAP request sent to the WebService:
<SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'> <SOAP-ENV:Body SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'> <intf:webservice_controller xmlns:intf='http://childDir.parentDir'> <args xsi:type='apachesoap:Map' xmlns:apachesoap='http://xml.apache.org/xml-soap'> <item> <key xsi:type='xsd:string'>property1</key> <value xsi:type='xsd:string'></value> </item> <item> <key xsi:type='xsd:string'>property2</key> <value xsi:type='xsd:string'></value> </item> <item> <key xsi:type='xsd:string'>property3</key> <value xsi:type='xsd:string'>z</value> </item> </args> </intf:webservice_controller> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
This behavior is documented in Flex 3.0 manuals. See Dynamic Classes for more information. A direct quote: