1 / 14

WDDX Case Study: Building a Cross CFUG Search

WDDX Case Study: Building a Cross CFUG Search. April Fleming. Introduction. “ Real world WDDX (not just a short introduction)” Problem I encountered developing an application How I used WDDX to solve the problem Benefits of using WDDX. Scenario .

Download Presentation

WDDX Case Study: Building a Cross CFUG Search

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. WDDX Case Study: Building a Cross CFUG Search April Fleming

  2. Introduction “Real world WDDX (not just a short introduction)” • Problem I encountered developing an application • How I used WDDX to solve the problem • Benefits of using WDDX

  3. Scenario • Data stored on 3 separate servers across the country • Using CFHTTP to access remote server • Remote server built query searching all fields on criteria entered by user. • Remote server performs query, outputs the query results with a set of predetermined display fields • Local server parses query results, stores each parsed record in a database, to be used and displayed.

  4. Problem • Parsing routine had to be written • If remote server output changed the parsing routine would no longer work until it was modified. • Required strict communication/cooperation between nodes, not practical • Needed to allow user to search on any given field, using logical operators • EX: “FirstName contains ‘A’ and FirstName contains ‘B’ • Needed knowledge of data on remote server to avoid rewriting the parsing routine if the remote server changed its structure • Needed to allow user to specify any or all fields to display in search results in any given order. • Needed knowledge of data on remote server to give user all possible return fields • Local parsing routine needed to be able to parse any possible combination of fields returned by remote server.

  5. Problem - cont’d • Storing Search Results • Needed to be able to store any given set of fields in any order • Current storage of search records to local table could not accommodate • If we stored return fields as text, could not access them as a recordset • Individually inserting records into the database was processor intensive and very slow. • All of the writing and reading from the ACCESS database were causing it to be corrupt.

  6. Solution Enter WDDX….

  7. What is WDDX? • WDDX is a tag Markup language written in XML. • The markup language describes the data which is being “marked up” • Serialization and Deserialization functions written for CFML, ASP, JavaScript,Java, PERL, and Python • Facilitates passing objects • Recordsets • Arrays • Structures

  8. WDDX Tag • <CFWDDX ACTION="" • INPUT="" • OUTPUT="" TOPLEVELVARIABLE="”> • ACTION: • CFML2WDDX - Serialize to WDDX Format • WDDX2CFML - Deserialize WDDX to CFML • CFML2JS - Serialize CFML to Javascript • WDDX2JS - Deserialize WDDX to Javascript • INPUT - Data to be “Serialized/Deserialized” • OUTPUT - Output variable for Serialized/Deserialized Data • TOPLEVELVARIABLE - Output variable for Javascript Object

  9. Terms • Serialize - converting data to WDDX format • Deserialize - extracting data in native language format • Packet - serialized data

  10. WDDX In Action • Had the remote server output a WDDX packet describing their data • Does not matter what language they use • Used <CFWDDX> to deserialize their packet • Was able to output over the deserialized query to create form for users to choose the fields they want to search • Used <CFWDDX> to serialize a structure containing search criteria. • Remote server outputs search results in packets • Local server deserializes results packets and manipulates as if queries had been run locally

  11. WDDX In Action - Cont’d

  12. Benefits • Parsing routine was already written, performed by WDDX tag • Remote server could return any data, WDDX packets are self-describing • User could specify any fields since parser could now parse any fields returned. • Packets could be written to files, or entire packets could be stored in database requiring less load on the database. • Surprisingly fast!

  13. Other Uses for WDDX • Syndication • Stocks quotes • News feeds • http://cfug.itcenter.org/ - Greg Witte’s Digital Daily • Using JavaScript to allow for multiple user input for a given field • Parent/child relationship • Multiple phone numbers • Transferring Data from Browser to Server • Wizard interface • Maintain state in an inherently stateless medium

  14. Resources • http://www.wddx.org/ • http://www.allaire.com/developer/ • http://www.xml.Com/ • Advanced ColdFusion 4.0 application development (ISBN 0-7897-1810-3) • Advanced ColdFusion development • XML journal (http://www.coldfusionjournal.Com/)

More Related