| By Corey Gilmore, Jason Blum, Phil McCarthy | Article Rating: |
|
| April 21, 2007 08:00 AM EDT | Reads: |
3,539 |
This content is reprinted from Real-World AJAX: Secrets of the Masters published by SYS-CON Books. To order the entire book now along with companion DVDs for the special pre-order price, click here for more information. Aimed at everyone from enterprise developers to self-taught scripters, Real-World AJAX: Secrets of the Masters is the perfect book for anyone who wants to start developing AJAX applications.
Common Server-Side Languages
The beauty of Web services being platform-agnostic is that we can use any language to develop them - although there are features to watch for when choosing a language. While a Web service can return data in any format, the title of this chapter is "Building AJAX-Friendly Web Services" and our examples will be returning XML or JSON. In keeping with that philosophy we'll look at languages with inherent XML support or a JSON library.
Language Rundown
We'll briefly touch on several of the more common languages that can be used to create Web services and support XML and JSON. Debating the merits of one server-side programming language over the other is as productive as a debate over the best operating system. We'll provide some basic information about several languages, but in the end the decision of which language to use will fall to you.
PHP
There are a number of JSON libraries freely available for PHP:
Zend_Json is part of the Zend Framework, which is currently available as a preview release from http://framework.zend.com/.
JSON-PHP is PHP implementation of JSON.
PHP-JSON is a C implementation of JSON-PHP that can be compiled and installed as a PHP extension. It's significantly faster, but will require root-level privileges on your Web server or a cooperative administrator. It can be downloaded from www.aurore.net/projects/php-json/.
We'll use the XMLRPC extension with our PHP Web services. PHP also has a SOAP extension available. The XMLRPC extension is poorly documented and you may find it easier to use XMLRPCEPI- PHP, which is at http://xmlrpc-epi.sourceforge.net/. More information about XML-RPC can be found at www.xmlrpc.com/. The PHP manual for XMLRPC is located at http://php.net/xmlrpc. The PHP manual for the SOAP extension is online at http://php.net/soap.
Perl
There are several Perl modules for JSON and XML-RPC:
JSON modules can be found at CPAN at http://search.cpan.org/dist/JSON/.
XMLRPC::Lite provides its own XML parser http://search.cpan.org/search?module=XMLRPC::Lite.
RPC::XML requires XML::Parser. http://search.cpan.org/dist/RPC-XML/.
ColdFusion
Jehiah Czebotar has written a JSON library for ColdFusion that can be downloaded from
http://jehiah.com/projects/cfjson/.
ColdFusion has native XML and SOAP support as documented at http://livedocs.macromedia.com/coldfusion/7/htmldocs/00000372.htm.
One thing that ColdFusion lacks is a decent XML-RPC parser. Thankfully Roger Benningfield has created one available at http://mxblogspace.journurl.com/users/admin/?mode=article&entry=763. With examples from his original post at http://support.journurl.com/users/admin/index.cfm?mode=article&entry=362.
This content is reprinted from Real-World AJAX: Secrets of the Masters published by SYS-CON Books. To order the entire book now along with companion DVDs, click here to order.
Published April 21, 2007 Reads 3,539
Copyright © 2007 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Corey Gilmore
Corey Gilmore is the president of CFG Consulting, Inc., specializing in developing rich internet applications with ColdFusion, PHP and Ajax for the Federal government and Fortune 100 clients. He guiltily enjoys designing and implementing low-cost, high performance business continuity plans using VMware ESX server. As the former Director of Information Technology for the United States Senate Democratic Leadership, he designed and implemented a continuity of operations plan to ensure Senate business continuity in the event of a disaster. Corey can be reached at cfgci.com.
More Stories By Jason Blum
Jason Blum is principal engineer with the advanced technologies development team in the United States Senate, Office of the Sergeant at Arms. Formerly the lead administrator of the Senate’s shared Web hosting environment, Jason now designs and manages the implementation of schema and pattern-centric solutions for Senate offices in XML, ColdFusion, Flex, and .NET. He is a Certified Advanced ColdFusion developer with a BA in philosophy, Masters Degrees in philosophy of education and in IT, and an intermediate certification in Hungarian from itk.hu.
More Stories By Phil McCarthy
Philip McCarthy is a UK-based software development consultant
specializing in J2EE and Web technologies. An early adopter of rich
browser-based client development, he has several years' experience of integrating Ajax technologies into enterprise Java frameworks, gained on projects in the financial services, telecoms, and digital media sectors. Philip is also the author of the "Ajax for Java Developers" series for IBM developerWorks, and blogs about software development at chimpen.com.
- Practical Approaches for Optimizing Website Performance
- SQL Anywhere Server and AJAX
- The Difference Between Web Hosting and Cloud Computing
- Ajax in RichFaces 3.3, JSF 2 and RichFaces 4
- Cloud Computing on Gartner's Top 10 List and SYS-CON Events' 2010 Calendar
- IBM Hardware Chief, Intel VC Exec Arrested in Insider Trading Scam
- US Post Office Hops a Ride on NetSuite’s Cloud
- Gang of Four Creates Cloud BI Stack
- Tactical Cloud Computing Panel at 1st Annual GovIT Expo
- Confessions of a Ulitzer Addict
- AJAX World RIA Conference & Expo Kicks Off in New York City
- An Introduction to Abbot
- What is Web 3.0?
- AJAXWorld RIA Conference & Expo 2009 West: Call for Papers
- Interviewing Java Developers With Tears in My Eyes
- Adobe Enters Cloud Computing with LiveCycle
- REA Is Where RIA Becomes the Norm
- RIAs for Web 3.0 Using the Microsoft Platform
- Practical Approaches for Optimizing Website Performance
- Social Media Terrorists
- Building a Drag-and-Drop Shopping Cart with AJAX
- What Is AJAX?
- Google Maps! AJAX-Style Web Development Using ASP.NET
- Flashback to January 2006: Exclusive SYS-CON.TV Interviews on "OpenAjax Alliance" Announcement
- AJAXWorld Conference & Expo to Take Place October 2-4, 2006, at the Santa Clara Convention Center, California
- AJAX Sponsor Webcasts Are Now Available at AJAXWorld Website
- How and Why AJAX, Not Java, Became the Favored Technology for Rich Internet Applications
- "Real-World AJAX" One-Day Seminar Arrives in Silicon Valley
- AJAXWorld University Announces AJAX Developer Bootcamp
- AJAX Support In JadeLiquid WebRenderer v3.1




































