You are on page 1of 29

Lesson 5

Database Interactivity and WDDX

Simeon Simeonov and Dick Steflik


• The need for Web distributed data exchange

• The crisis of web applications
• The need for XML middleware
• Web Distributed Data Exchange (WDDX)
• WDDX scenarios
• Demos
• Call to action
Metcalf’s Law of Connectivity

• Metcalf’s Law of Connectivity

– The value of a network is a function of the
number of nodes connected to that network;
value grows exponentially with each node
• The Web is the new computing platform
– The number of nodes on the Net is huge, and
growing at an ever increasing rate, so...

Have we Achieved World Peace?
• One big assumption does not hold true
– Network nodes leverage peers’ data and
– A Web system must be a data and service
portal, not just an outward facing end-user
• Web applications are not so designed
– Most view web applications as having a fixed
end-user base working through web browsers
– The combination of HTML + script provides no
separation of data and processing 4
Case: FedEx Package Tracking
• Individuals track packages via browsers, but...
• FedEx’s real customers are corporations
– They want to integrate their order tracking
systems with FedEx’s package tracking system
– They cannot do this using the existing system
• Redesign requires “public data interfaces”
– Requires exchange of structured data between
browsers and servers and in between servers

The Crisis of Web Applications
• Structured data exchange is not happening
– HTTP is a flat text-based protocol
– Browsers are data-starved; despite ever
increasing processing capabilities, they do little
more than user-interface related work
– Servers are separated by the walls imposed by
under-powered data exchange
• Solution
– Break these walls down; let web applications
execute on the entire network
– We know XML can help! But, how? 6
Native XML Approach

• DTD design
• XML data generation
• XML parsing and processing
– SAX, DOM, …
• XML transformation

Sounds Great, But…

• Native XML processing is still not very

– XML is a young field
– The standards landscape is in flux
– Many tools are immature and/or expensive
– Mass developer community lacks expertise
• How can the Web take advantage of the
benefits of XML in this environment?
The Need For XML Middleware

• Solution
– A mechanism for exchanging structured data
that hides the details of XML processing
• What is required?
– The Web is simple, pragmatic, and ubiquitous
– Page-based web applications that run on web
application servers (Perl scripts, Active Server
Pages, ColdFusion) rule the field
How should it be done?
• Work directly with application data
– Developers never see XML, but they benefit from it
• Cross platform
– Different OSs: Windows, Mac, Unix
– Different languages: ColdFusion Markup Language
(CFML), VBScript, JavaScript, Java, C/C++,
COM, CORBA, Frontier, Perl, PHP, Python
• Open and flexible
– Easy to contribute to
– Can track evolving W3C standards
• Free! 10
How should it work?
Application Data

Platform X Serialization


Platform Y

Application Data

Web Distributed Data Exchange
– Language and platform neutral representation of
common application data structures: strings,
numbers, booleans, date-time values, arrays,
associative arrays, and recordsets
• WDDX platform modules
– Serialization/deserialization modules for CFML,
COM (C/C++, ASP, and all Windows apps),
JavaScript (browser), Perl, and Java
• WDDX datatypes
– Common API uses native datatypes when possible
Technology Comparisons
– WDDX abstracts the process of DTD creation, XML
generation, and XML parsing for app data
– WDDX is an API built on top of DOM
• SOAP and WebBroker
– WDDX is about data, not object method requests
– WDDX has no notion of a service or an interface
• RDF and DCD
– WDDX is not about meta-data
WDDX Evolution
• WDDX DTD is versionable
– Multiple versions of WDDX can interoperate
– WDDX can track evolving W3C standards
• Source code is open
– Encourages involvement and participation
– Lowers the cost of WDDX-enabling a platform
– Allaire is working together with third parties
• It’s free!
– The more nodes speak WDDX, the better
When Should One Use WDDX?
• Point-to-point data exchange
– No pre-existing XML/SGML content
– Application-level data is ‘produced’
– Applications ‘consume’ the data
– Only one use for the XML data representation
• Multiple ad hoc data exchanges
– Little or no benefit from custom vocabularies
– Example: per page browser-server data
WDDX Scenarios
ColdFusion WDDX
Server XML


CF Server

Windows/Java ASP Server


JavaScript Browser

Web Technology Adoption Path
• XMLless Web
– Structure, where art thou?
• XML middleware
– Browsers and servers exchange structured data
– Developers can benefit from WDDX now
– Proof of XML benefits to the enterprise
• XML-enabled Web
– A better place for all

Call to Action
• Want to see WDDX in action?
– Download ColdFusion:
– Visit the WDDX site:
• Want to try WDDX out?
– download Software Development Kit (SDK)
– Send email to It’s free!


• What is in the SDK

– COM / ActiveX Implementation
– Java Implementation
– JavaScript Implementation
– Perl Implementation
– PHP Implementation
– ColdFusion Implementation
– "A2Z" Example Database
COM/ActiveX Implementation
• set of DLLs (that must be registered) that
implement the required XML parser and
WDDX components
• Server-side ActiveX
• Plugs into IIS for ASP use

Java Implementation

• The Java implementation is distributed as a

.jar archive of compiled .class files, and as
source .java files. You will use these files
with whatever Java development tool (or
JDK) that you are using

JavaScript Implementation
• The JavaScript implementation is distributed as
three JavaScript (.js) files. The "core" file is
wddx.js, which defines the WddxRecordset and
WddxSerializer objects.
• Additionally, the archive includes wddxDes.js,
which defines the WddxDeserializer object, and
wddxRsEx.js, which provides additional
functionality for recordset objects.

Perl Implementation

• A brand-new module for Perl

has been graciously contributed to the
SDK by Scott Guelich. The module
provides the same kind of support as the
other implementations, including
serialization, deserialization, and the new
binary support

PHP Implementation

• The support is not distributed as part of the

SDK at this time.
• to find out more you can find out more
about the PHP/WDDX functionality,
including reference documentation, at

Cold Fusion Implementation

• The Cold Fusion implementation is

included in Cold Fusion 4.0 and later
• Currently, JavaScript support for WDDX
does not provide a way to deserialize a
WDDX packet. The server will deserialize
it into Javascript and deliver it to the
requesting browser
WDDX to Javascript

• to deserialize a WDDX packet to Javascript

at the browser some additional scripts are
– wddxDes.js - Nate Weiss
– xparse.js - Jeramie Miller
• search the web for the file names, they are
in a number of places

Basic concepts
Take a native object; serialize it into a WDDX packet
Send it across the network
Deserialize it back into a native object

Serializing the native objects into WDDX packets gives us al way of of moving
environment specific (Java, CF,Perl…) objects around the network and
delivering them to the same environment or another other environment

select FirstName,LastName,Email from Employees
produces a ColdFusion record set, serialixing the recordset produces a WDDX packet

<wddxPacket version='0.9'>
<recordset rowCount='5' fieldNames='FIRSTNAME,LASTNAME,EMAIL'>

<field name='FIRSTNAME'>
<field name='LASTNAME'>
<field name='EMAIL'>
deserialized into Javascript

EmployeeData=new WddxRecordset();_t2=newArray();_t2[0]="Carolynn";_t2[1]="Dave";_t2[2]="Linda";

Note that because of the serialization and deserialization

that the object that started out as a ColdFusion recordset
has ended up as a set of Javascript arrays