May 17, 2002 1:00 AM PT

Supplement: The adventures of JWSDP

Sun Microsystems finally takes action on the Web services front

Please do not use my name in any way. Please do not even divulge the fact that I own a machine. I have entirely stopped using the Type-Writer, for the reason that I never could write a letter with it to anybody without receiving a request by return mail that I would not only describe the machine but state what progress I had made in the use of it, etc., etc. I don't like to write letters, and so I don't want people to know that I own this curiosity-breeding little joker. (Mark Twain, Letter to Densmore, Yost & Co., March 19, 1875)

Thus wrote Mark Twain to the Remington company (which partnered with Densmore, Yost & Co. to produce the first commercially successful typewriter) about the tool generations of writers later found so indispensable. Always eager to be on the cutting edge—he was the first to submit a fully typed manuscript to a publisher—Twain had more than his share of frustrations with early typewriters: "The early machine was full of caprices, full of defects—devilish ones. It had as many immoralities as the machine of today has virtues. After a year or two I found that it was degrading my character..."

If you worked with early incarnations of Web services technologies, you might well share Twain's sentiment: Without the proper tools, creating Web services can be as excruciating as, say, preparing the manuscript for The Adventures of Huckleberry Finn with just a pen. Formatting XML messages and converting between Java and SOAP (Simple Object Access Protocol) invocations by hand, for example, would be so error-prone as to render Web services programming an impractical proposition. Therefore, tools that automate these tedious tasks assume great importance if Web services are to become standard parts of a Java developer's bag of tricks. But Web service development tools have up to now been simplistic, often standing in a programmer's way, instead of offering a helping hand.


This situation is about to change. According to this year's JavaOne tenor, Web services are here, and you can start developing them right away. JavaOne's organizers devoted an entire track to Web services, with no less than 78 full sessions on the topic. At the heart of those talks was a set of APIs—JAXP (Java APIs for XML Processing), JAXR (Java API for XML Registries), JAXM (Java APIs for XML Messaging), to name a few—exposing Web service technology implementations to Java programmers. Despite that overall excitement, the tone of many sessions made it clear: Most of these technologies are works in progress. The ink is still wet on the specs, and conspicuous construction signs are posted on the reference implementations.

The one bright spot was Sun Microsystems' Java Web Services Developer Pack, or JWSDP, which Sun made available for early access download from its Website. At JavaOne, Sun positioned the JWSDP as a tool "most developers" would find suitable for Web service development, suggesting you don't have to be a Mark Twain of Java to start programming Web services now.

To understand what the JWSDP offers, some history is in order. Until recently, Sun received criticism for inaction on the Web services front, especially in light of Microsoft's aggressive promotion of its .Net framework. Indeed, the .Net SDK has been available from Microsoft's Website for free download for a while. Sun's strategy has been to work with open source initiatives on major pieces of the Web services puzzle, instead of proposing quick-fix solutions in technical areas still marked as terra incognita. While that reflects Sun's "innovation happens elsewhere" dictum, it also means that the pace of releasing production-quality implementations will be slower.

However, Sun has been hard at work producing reference implementations of several Web service-related APIs. In the JWSDP, it packaged some of those technologies into a single, free download, adding some infrastructure to ease Web service deployment. Thus, the JWSDP lets Java developers create useful Web services with what is available now, instead of forcing them to either assemble those tools themselves or use another vendor's tools. In that sense, the JWSDP is a counterpart of Microsoft's .Net SDK, with the important caveat that the latter is based on proprietary code, whereas you can obtain the source code for the JWSDP. The JWSDP is currently in early-access release, and Sun plans to ship a production-quality, or FCS (first customer ship), version by the end of June.

Take it for a test drive

The best way to see what the JWSDP offers is to take it for a spin: Think up a Web service that could benefit your business or organization now, and create a prototype using the tools in the JWSDP. You are likely familiar with those tools already. JAXP forms JWSDP's core. The APIs let you work with XML documents in a variety of ways from Java programs. Two XML-based communication models complement JAXP's XML-processing capability: JAXM and JAX/RPC (Java APIS for XML-based Remote Procedure Calls). JAXM lets you arrange message exchanges between Web services, based on XML document formats. The message exchange can take place synchronously—causing a client program to wait for a reply message before proceeding—or asynchronously, meaning that a Web service's client does not expect an immediate response. With JAX/RPC, you define an object's interface in Java, provide an implementation of that interface, and then map the Java interface type to an XML definition. Internet services that retrieve your XML-ized service interface can make remote method calls to your implementation. That is similar to RMI (Remote Method Invocation), with some important caveats (most notably, lacking object mobility).

While all these technologies and their implementations are downloadable from various sites, the JWSDP comes with tools that automate many tedious Web service-related responsibilities. For instance, JWSDP comes with a stub compiler that, given a Java interface, compiles a WSDL (Web Services Description Language) file for a Web service. (If you're familiar with RMI, think rmic (the RMI compiler).) You can then register that WSDL file in a Web service registry (see the main article, "Web Services Take Float with JAXR") so that others can find and use your service. The JWSDP comes with a standalone JAXR capability-level 0 Web service registry, supporting the Universal Description Discovery and Integration (UDDI) 2.0 registry standard. To deploy Web services, the JWSDP bundles the latest Apache Tomcat release (4.0.3), with Apache Ant-based task templates to register and manage Web services inside Tomcat's servlet containers. Last, but by no means least, Sun has prepared an excellent JWSDP tutorial that takes you through the Web service development cycle. The integration between Ant, Tomcat, and the various XML-related Java APIs is perhaps the JWSDP's greatest benefit, as it automates time-consuming and error-prone tasks.

How does Sun's JWSDP stack up to the competition? Stay tuned for my next Web Services column for a comparison. In the meantime, while the JWSDP offers no developer panacea, it will give you a headstart developing Java-based Web services. Who knows, your friends (or boss) might just become curious and inquire about the little tool that made you productive so quickly.

Learn more about this topic