Flex 2 HotFix 2 includes an updated web services library that can cause backwards compatibility issues with certain applications. The information below details the updated serialization/de-serialization maps.

Serializing Web Service Data in Flex

This TechNote provides information about data mapping between SOAP-compliant web services and ActionScript objects in Adobe Flex SDK 2.0.1 hot fix 2 and Adobe LiveCycle Data Services ES, which uses hot fix The ActionScript APIs for serializing to and from ActionScript data types in a Flex application and XML Schema and SOAP data types is greatly improved in hot fix 2, but could affect backward compatibility in existing Flex applications.

For information about SOAP, see http://www.w3.org/TR/soap/.

For information about XML Schema, see http://www.w3.org/XML/Schema.

Encoding to XML Schema and SOAP from ActionScript 3

The following tables show the mappings from ActionScript 3 data types to XML Schema and SOAP data types.

Encoding ActionScript 3 complex types to XML Schema complex types

The following table shows the encoding mappings from ActionScript 3 types to XML Schema complex types:

XML Schema definition Supported ActionScript 3 types Notes
Top Level Elements
xsd:element

nillable == true
Object If input value is null, encoded output is set with xsi:nil attribute.
xsd:element

fixed != null
Object Input value is ignored and fixed value is used instead.
xsd:element

default != null
Object If input value is null, this default value is used instead.
Local Elements
xsd:element

maxOccurs == 0
Object Input value is ignored and omitted from encoded output.
xsd:element

maxOccurs == 1
Object Input value is processed as a single entity. If the associated type is a SOAP-encoded Array, then Arrays or mx.collection.IList implementations pass through intact to be special cased by the SOAP encoder for that type.
xsd:element

maxOccurs > 1
Object Input value should be iterable (such as an Array or mx.collections.IList implementation), although non-iterable values are wrapped before processing. Individual items are encoded as separate entities according to the definition.
xsd:element

minOccurs == 0
Object If input value is undefined or null, encoded output is omitted.

Encoding ActionScript 3 types to XML Schema built-in types

The following table shows the encoding mappings from ActionScript 3 types to XML Schema built-in types:

XML Schema type Supported ActionScript 3 types Notes
xsd:anyType

xsd:anySimpleType
Object Boolean -> xsd:boolean

ByteArray -> xsd:base64Binary

Date -> xsd:dateTime

int -> xsd:int

Number -> xsd:double

String -> xsd:string

uint -> xsd:unsignedInt
xsd:base64Binary flash.utils.ByteArray mx.utils.Base64Encoder is used (without line wrapping).
xsd:boolean Boolean

Number

Object
Always encoded as true or false.

Number == 1 then true, otherwise false.

Object.toString() == "true" or "1" then true, otherwise false.
xsd:byte

xsd:unsignedByte
Number

String
String first converted to Number.
xsd:date Date

Number

String
Date UTC accessor methods are used.

Number used to set Date.time.

String assumed to be preformatted and encoded as is.
xsd:dateTime Date

Number

String
Date UTC accessor methods are used.

Number used to set Date.time.

String assumed to be pre-formatted and encoded as is.
xsd:decimal Number

String
Number.toString() is used. Note that Infinity, -Infinity and NaN are invalid for this type.

String first converted to Number.
xsd:double Number

String
Limited to range of Number.

String first converted to Number.
xsd:duration Object Object.toString() is called.
xsd:float Number

String
Limited to range of Number.

String first converted to Number.
xsd:gDay Date

Number

String
Date.getUTCDate() is used.

Number used directly for day.

String parsed as Number for day.
xsd:gMonth Date

Number

String
Date.getUTCMonth() is used.

Number used directly for month.

String parsed as Number for month.
xsd:gMonthDay Date

String
Date.getUTCMonth() and Date.getUTCDate() are used.

String parsed for month and day portions.
xsd:gYear Date

Number

String
Date.getUTCFullYear() is used.

Number used directly for year.

String parsed as Number for year.
xsd:gYearMonth Date

String
Date.getUTCFullYear() and Date.getUTCMonth() are used.

String parsed for year and month portions.
xsd:hexBinary flash.utils.ByteArray mx.utils.HexEncoder is used.
xsd:integer



...and derivatives:

xsd:negativeInteger

xsd:nonNegativeInteger

xsd:positiveInteger

xsd:nonPositiveInteger
Number

String
Limited to range of Number.

String first converted to Number.
xsd:int

xsd:unsignedInt
Number

String
String first converted to Number.
xsd:long

xsd:unsignedLong
Number

String
String first converted to Number.
xsd:short

xsd:unsignedShort
Number

String
String first converted to Number.
xsd:string



...and derivatives:

xsd:ID

xsd:IDREF

xsd:IDREFS

xsd:ENTITY

xsd:ENTITIES xsd:language

xsd:Name

xsd:NCName

xsd:NMTOKEN

xsd:NMTOKENS

xsd:normalizedString

xsd:token
Object Object.toString() is invoked.
xsd:time Date

Number

String
Date UTC accessor methods are used.

Number used to set Date.time.

String assumed to be preformatted and encoded as is.
 
xsi:nil null If the corresponding XML Schema element definition has minOccurs > 0, a null value is encoded using xsi:nil; otherwise the element is omitted entirely.

Encoding ActionScript 3 types to SOAP-encoded types

The following table shows the mapping from ActionScript 3 types to SOAP-encoded types:

SOAPENC type Supported ActionScript 3 types Comments
soapenc:Array Array

mx.collections.IList
SOAP-encoded Arrays are special cased and are only supported with RPC-encoded style web services.
soapenc:base64 flash.utils.ByteArray Encoded in the same manner as xsd:base64Binary.
soapenc:* Object Any other SOAP-encoded type is processed as if it were in the XSD namespace based on the localName of the type's QName.

Decoding XML Schema and SOAP to ActionScript 3

The following tables show the mappings from ActionScript 3 data types to XML Schema and SOAP data types.

Decoding XML Schema built-in types to ActionScript 3 types

The following table shows the decoding mappings from XML Schema built-in types to ActionScript 3 types:

XML Schema type Decoded ActionScript 3 types Notes
xsd:anyType

xsd:anySimpleType
String

Boolean

Number
If content is empty -> xsd:string



If content cast to Number and value is NaN, or

if content starts with "0" or "-0", or

it content ends with "E":

then, if content is "true" or "false" -> xsd:boolean

otherwise -> xsd:string



Otherwise content is a valid Number and thus -> xsd:double.
xsd:base64Binary flash.utils.ByteArray mx.utils.Base64Decoder is used.
xsd:boolean Boolean If content is "true" or "1" then true, otherwise false.
xsd:date Date If no timezone information is present, local time is assumed.
xsd:dateTime Date If no timezone information is present, local time is assumed.
xsd:decimal Number Content is created via Number(content) and is thus limited to the range of Number.
xsd:double Number Content is created via Number(content) and is thus limited to the range of Number.
xsd:duration String The content is returned with whitespace collapsed.
xsd:float Number Content is converted through Number(content) and is thus limited to the range of Number.
xsd:gDay uint Content is converted through uint(content).
xsd:gMonth uint Content is converted through uint(content).
xsd:gMonthDay String The content is returned with whitespace collapsed.
xsd:gYear uint Content is converted through uint(content).
xsd:gYearMonth String The content is returned with whitespace collapsed.
xsd:hexBinary flash.utils.ByteArray mx.utils.HexDecoder is used.
xsd:integer



...and derivatives:

xsd:byte

xsd:int

xsd:long

xsd:negativeInteger

xsd:nonNegativeInteger

xsd:nonPositiveInteger

xsd:positiveInteger

xsd:short

xsd:unsignedByte

xsd:unsignedInt

xsd:unsignedLong

xsd:unsignedShort
Number Content is decoded via parseInt()
xsd:string



...and derivatives:

xsd:ID

xsd:IDREF

xsd:IDREFS

xsd:ENTITY

xsd:ENTITIES xsd:language

xsd:Name

xsd:NCName

xsd:NMTOKEN

xsd:NMTOKENS

xsd:normalizedString

xsd:token
String The raw content is simply returned as a String.
xsd:time Date If no timezone information is present, local time is assumed.
 
xsi:nil null  

Decoding SOAP-Encoded types to ActionScript 3 types

The following table shows the decoding mappings from SOAP-encoded types to ActionScript 3 types:

SOAPENC type Decoded ActionScript type Notes
soapenc:Array Array

mx.collections.ArrayCollection
SOAP encoded Arrays are special cased. If makeObjectsBindable is true the result is wrapped in an ArrayCollection, otherwise a simple Array is returned.
soapenc:base64 flash.utils.ByteArray Decoded in the same manner as xsd:base64Binary.
soapenc:* Object Any other SOAP encoded type is processed as if it were in the XSD namespace based on the localName of the type's QName.

Decoding custom types

The following table shows the decoding mappings from custom data types to ActionScript 3 data types:

Custom type Decoded ActionScript 3 type Notes
Apache Map

http://xml.apache.org/xml-soap:Map
Object SOAP representation of java.util.Map. Keys must be representable as Strings.
Apache Rowset

http://xml.apache.org/xml-soap:Rowset
Array of Objects  
ColdFusion QueryBean

http://rpc.xml.coldfusion:QueryBean
Array of Objects

mx.collections.ArrayCollection of Objects

If makeObjectsBindable is true, the resulting Array is wrapped in an ArrayCollection.

XML Schema element support

This section lists XML Schema structures that are partially supported or unsupported in this release.

Partially supported XML Schema structures

The following XML Schema structures or structure attributes are only partially implemented in this release:

<choice><all><union>

Unsupported XML Schema structures

The following XML Schema structures or structure attributes are ignored and are not supported in this release:

<attribute use="required"/> <elementsubstitutionGroup="..." unique="..." key="..." keyref="..." field="..." selector="..."/> <simpleType> <restriction><minExclusive> <minInclusive> <maxExclusiv> <maxInclusive> <totalDigits> <fractionDigits> <length> <minLength> <maxLength> <enumeration> <whiteSpace> <pattern> </restriction> </simpleType> <complexTypefinal="..." block="..." mixed="..." abstract="..."/> <any processContents="..."/><annotation>

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy