(From IEEE Software)
Bookshelf
The Only Web Services Guide You'll Ever Need
Art Sedighi
J2EE Web Services: The Ultimate Guide, by Richard Monson-Haefel, Addison-Wesley Professional, 2003, ISBN 0-321-14618-2, 928 pp., US$49.99.
Richard Monson-Haefel did a tremendous job putting J2EE Web Services: The Ultimate Guide together. Numerous Web services books exist, but this is the best practical guide. It covers the basic protocols developers need, such as WSDL (Web Services Description Language), UDDI (Universal Description, Discovery, and Integration), and SOAP. It also discusses implementation issues and available tools, such as JAX-RPC (Java API for XML-based Remote Procedure Call), SAAJ (SOAP with Attachments API for Java), and JAXP (Java API for XML Processing). J2EE Web Services is a rare book—it covers Web services from beginning to end without getting into Web services integration, so developers can learn how to get started without getting bogged down in specific integration issues.
Monson-Haefel also addresses a topic I rarely see covered—the Web services Basic Profile 1.0 specification. You might think that BP is unimportant, but I disagree. Given developers’ numerous misconceptions about Web services, they need to get the facts straight before getting in too deep.
Basic protocols
Although it’s not a direct part of Web services, HTTP plays an important role in the overall Web services infrastructure. BP recommends using HTTP for all transports, even though other protocols can do the job as well. J2EE Web Services discusses HTTP’s ins and outs. The coverage is basic, so even if you’re not a networking guru, you’ll likely understand the section.
Next, Monson-Haefel delves into SOAP and SOAP messaging. He gives examples so the reader can take small steps and build on them as the topics advance. He also covers in detail SOAP’s four messaging modes:
- Document/Literal. A SOAP body element contains a well-formed XML document.
- RPC/Literal. The SOAP messages model the calls to procedures or method calls with parameters and return values.
- RPC/Encoded and Document/Encoded. Both modes are doable by SOAP, but BP doesn’t allow them. In this situation, going back to the basics is helpful. Knowing where some Web services features or restrictions come from could help an up-and-coming developer understand the topic more thoroughly.
WSDL is another important topic for developers, so a chapter analyzes typical WSDL documents. Tools can generate WSDL documents from Java classes, and vice versa, so it’s nice to know what WSDL is all about and how to translate objects into Java types. Two examples then pair WSDL and SOAP to help the reader better understand the topic.
The book also explains with numerous examples UDDI and its related technologies, including UDDI data structures and inquiry, publish APIs, and how to publish and update services. JAXR (Java API for XML Registries), the most popular tool that encapsulates the difficulties of using UDDI, closes the loop.
J2EE Web Services also includes detailed XML coverage, because readers must know enough about XML and XML schema to understand its remaining topics. Monson-Haefel covers these issues in a Web services context. He refers to these two chapters’ syntax and examples throughout the book.
Available tools
JAX-RPC is the first place that Monson-Haefel makes the connection between XML and the Java programming environment. He discusses how the JAX-RPC works and what a JAX-RPC compiler generates from a WSDL document. Monson-Haefel depicts various implementation scenarios, such as using RPC with servlets or Enterprise JavaBeans (EJBs). Discussing the JAX-RPC client APIs and their interactions with the server side helps readers understand how Web services really work. To make the subject more interesting, Monson-Haefel delves into SAAJ. If you’re considering Web services for more than just a pet shop store, you’ll need SAAJ to build SOAP messages. SAAJ abstracts the difficulties of creating SOAP messages that the book mentions early on. The same SOAP messages that developers used to construct manually can now be constructed by a couple lines of code in SAAJ.
What do developers need after constructing SOAP messages? They must decode the messages to send them and get the data out of them. That’s where message handlers come into play; the book discusses them in the context of servlets and EJBs as well. So, let’s close the loop here:
- Construct messages via SAAJ.
- Ship messages using SAX-RPC.
- Receive messages and get the data out of them with message handlers.
How can you create SOAP messages if you don’t know the interface? That’s where WSDL and the JAX-RPC complier can help. JAX-RPC can help generate WSDL documents from the Java interface, and vice versa if need be. Just like the good old days of Corba’s Interface Definition Language, we still need to know how mapping between the two languages occurs. Monson-Haefel devotes considerable time to that topic, using numerous examples from simple to complex.
Ultimately, the book accomplishes its goal; developers who read it from beginning to end will learn how to develop Web services using the available technologies. I’d recommend it to anyone getting started with Web services.
Art Sedighi is a solutions architect at Platform Computing and a freelance writer. Contact him at sediga@alum.rpi.edu.