Web ServicesJava XML Pack Winter Release: Tools for Developing Web Services

Java XML Pack Winter Release: Tools for Developing Web Services

Developer.com content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

Web services promise to make their impact felt in 2002. Although various implementations and definitions surround Web services, developers generally associate XML, XML parsing, XML-based messaging, and service registries as essential components of the Web services infrastructure.

Both the open-source community such as Apache and the vendor community such as IBM have been making toolkits, components, and implementations of various pieces of Web services. With the Winter Release of the XML Pack, Sun is pulling together some of the key components for creating Web services under a single download. These components include reference implementations for each of the following:

  • Java API for XML Processing (JAXP)
  • Java API for XML Messaging (JAXM)
  • Java API for XML Registries (JAXR)
  • Java API for XML-based RPC

Piroz Mohseni

JAXP is the oldest of the four components. By providing a pluggable architecture, any compliant XML parser could be used with the JAXP API. The particular reference implementation uses Xerces for XML parsing and Xalan for XSLT processing. Both implementations are from the Apache Software Foundation. The two .jar files associated with JAXP are xerces.jar and xalan.jar, corresponding to the two reference implementations. You will also find the standard API documentation as part of the distribution.

If you are looking to pass XML messages between two entities, you want to check out the reference implementation of JAXM. Both synchronous (request-response) and asynchronous forms of communication are supported. The basis of messages is SOAP. The simplest case would be for two applications to exchange SOAP messages directly. This requires both end-points to be functioning, as well as the underlying transport, for the duration of the message exchange. For situations where guaranteed delivery, reliability and message logging are important, JAXM provides support for a message “server” known as a Remote Provider. The message is not sent directly to the recipient, but received by the remote provider first. It is kept there until delivered to the recipient, which means the sending application can disconnect from the Remote Provider, and the message would still be delivered to its final destination.

With the Java XML Pack and Tomcat, you have a set of tools to experiment and develop Web services.

While the queuing concept is not new, the fact that JAXM supports this asynchronous mode of communication makes it more applicable to B-to-B applications that use HTTP as their transport. JAXM consists of two packages. They are javax.xml.soap and javax.xml.messaging, which implement the point-to-point and asynchronous modes, respectively. A number of examples are included in the download. Some of them require usage of a servlet engine such as Tomcat. One interesting example is JAXM Tags, which shows how JSP taglibs can be used to generate and consume SOAP messages.

Similar to how phone directories and Web search engines are needed to locate phone numbers and URLs, the Web services world requires a directory to allow applications to find appropriate services. So far, several directory specifications have been proposed, such as UDDI, ebXML, and OASIS. The Java API for XML Registries provides a uniform API to access any registry service. Examples for publishing a service, querying a directory of services, and browsing are provided. You will need Tomcat to run the examples.

The last piece of the bundle is the Java API for XML-based RPC. Using SOAP 1.1, this API provides a cross-platform mechanism for RPC-based programming in Java. As I looked through the API and documentation, it reminded me of RMI programming except that it uses XML, SOAP, and WSDL. The reference implementation ships with a tool (xrpcc) that will generate WSDL and other appropriate files for the client and server. Keep an eye on JAX-RPC and its future development. Since RPC-based programming has been around for a while, this set of APIs may prove to be more effective than direct SOAP programming. Much of the complexities of SOAP are eliminated. A client makes calls to methods on a local object (again similar to RMI), which in turn translate and transmit those calls to the remote service.

With the Java XML Pack and Tomcat, you have a set of tools to experiment and develop Web services. There is a bit of learning curve, but given your familiarity with the Java platform, it will not be a big hurdle. Make sure you take advantage of the separate tutorial download as well.

About the Author

Piroz Mohseni is founder of Bita Technologies, focusing on business improvement through the effective use of technology. His areas of interest include enterprise Java, XML, and e-commerce applications. Contact him at mohseni@bita-tech.com.

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Latest Posts

Related Stories