Adobe COLDFUSION 9 Manual page 1091

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Using Web Elements and External Objects
WDDX and web services
WDDX does not compete with web services. It is a complementary technology focused on solving simple problems of
application integration by sharing data on the web in a pragmatic, productive manner at low cost.
WDDX offers the following advantages:
• It can be used by lightweight clients, such as browsers or Flash Player.
• It can be used to store complex data structures in files and databases.
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 could 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 in the preceding code.
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 www.openwddx.org.
Note: The
tag and the wddx.js JavaScript functions use UTF-8 encoding to represent data. Any tools that
cfwddx
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.
WDDX data type support
The following text describes the data types that WDDX supports. This information is a distillation of the description
in the WDDX DTD. For more detailed information, see the DTD at www.openwddx.org.
CFScript
x = structNew();
x.a = "Property a";
x.b = "Property b";
Last updated 8/5/2010
1086

Advertisement

Table of Contents
loading

Table of Contents