Applications that take advantage of WDDX can continue to do so if they start to use web services.
These applications could also be converted to use web services standards exclusively; only the
service and data interchange formats—not the application model—must change.
How WDDX works
The following example shows how WDDX works. A simple structure with two string variables
might have the following form after it is serialized into a WDDX XML representation:
<var name='x'>
<struct>
<var name='a'>
<string>Property a</string>
</var>
<var name='b'>
<string>Property b</string>
</var>
</struct>
</var>
When you deserialize this XML into CFML or JavaScript, the result is a structure that is created
by either of the following scripts:
JavaScript
x = new Object();
x.a = "Property a";
x.b = "Property b";
Conversely, when you serialize the variable x produced by either of these scripts into WDDX, you
generate the XML listed above.
ColdFusion provides a tag and JavaScript objects that convert between CFML, WDDX, and
JavaScript. Serializers and deserializers for other data formats are available on the web. For more
information, see http://www.openwddx.org
Note: The
cfwddx
Any tools that deserialize ColdFusion-generated WDDX must accept UTF-8 encoded characters.
UTF-8 encoding is identical to the ASCII and ISO 8859 single-byte encodings for the standard 128
"7-bit" ASCII characters. However, UTF-8 uses a two-byte representation for "high-ASCII" ISO
8859 characters where the initial bit is 1.
tag and the wddx.js JavaScript functions use UTF-8 encoding to represent data.
CFScript
x = structNew();
x.a = "Property a";
x.b = "Property b";
Moving complex data across the web with WDDX
699
Need help?
Do you have a question about the COLDFUSION MX 61-DEVELOPING COLDFUSION MX and is the answer not in the manual?
Questions and answers