Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOAP parameter serialization

Level 2
Level 2
Hi all,

I'm looking for some information on how Flash/Flex serializes
parameters to WebService operations. If a web service operations
takes a simple parameter like a string, I can just pass it in as
the argument to the Operation.send() method but what if the
parameter is a "complexType"? Do I need to create an xml node or
just an object with public properties, etc...?

Any info on this would be much appreciated.

3 Replies
Level 3
Level 3

For complex type you can pass the parameter in object. for

WSDL type definition

<complexType name="SOAPStruct">


<element name="varString" nillable="true"
type="xsd:string" />

<element name="varInt" type="xsd:int" />

<element name="varFloat" type="xsd:float" />



_service.echoStruct({varString:'The String', varInt:245,

or pass it through from tag declarion: for example

<mx:operation name="echoStruct" result="onResult(event)"

<mx:request format="object">


<varString>The String</varString>






and you can also construct it as xml, for example

<mx:request format="xml">

<ns1:doGoogleSearch xmlns:ns1="urn:GoogleSearch"



<start xsi:type="xsd:int">0</start>

<maxResults xsi:type="xsd:int">10</maxResults>

<filter xsi:type="xsd:boolean">true</filter>

<restrict xsi:type="xsd:string" />


<lr xsi:type="xsd:string" />

<ie xsi:type="xsd:string">latin1</ie>

<oe xsi:type="xsd:string">latin1</oe>



Hope the above info help! Thanks!

William Chan
Level 2
Level 2
William - Thank you, this is helpful. One other thing
though.. a few of the web service operations I need to call have a
parameter defined like this:

<complexType name="Account">


<attribute name="Name" type="string" use="required"/>

<attribute name="Value" type="string" use="required"/>


Notice that the Name and Value items are attributes, not
sub-elements. If I create an object like:

var param:Object = {Name:"xxxx", Value:"yyyy"};

is there a way to have these properties encoded as attributes
as opposed to sub-elements?

Level 3
Level 3
Ryan - you can just pass the object, flex does take care
where it is element or attribute

following is the sample(one of testcase we have)

<s:complexType name="Person">


<s:element minOccurs="1" maxOccurs="1" name="Age"
type="s:double" />

<s:element minOccurs="1" maxOccurs="1" name="ID"
type="s:float" />


<s:attribute name="Name" type="s:string" />

<s:attribute name="Male" type="s:boolean" />


var expected:Object = new Object();

expected.Name = "Bob Smith";

expected.Male = true;

expected.Age = 31;

expected.ID = 12345;