JAX-RPC (Java API for XML-Based RPC) is an application program interface (API) in the Java Web Services Developer Pack (WSDP), JAX-RPC is a specification that is developing through the Java Community Process (JCP). It aims to provide a JCP-sanctioned standard set of Java APIs for both a client-side and server-side programming model.
These JAX-RPC APIs leverage interoperable communications within Java applications with a protocol design center based on, but not limited to,SOAP. It covers the following areas:
- A Java code generation model for client-side stubs and server-side tie classes, based on a set of conventions for mapping WSDL to Java and Java to WSDL.
- An API for dynamic SOAP-RPC and a Call interface that is conceptually similar to Apache SOAP. Call semantics include synchronous invoke and synchronous invoke/one-way. JAX-RPC does not address asynchronous invocation in its 1.0 rendition. A true asynchronous model would require callbacks (onMessage, etc). The one-way invocation model defined in the API is considered synchronous.
- A model for defining a service, registering it, and invoking it within the J2EE and J2SE environments. This model covers typical J2EE/J2SE deployment issues such as creating deployment descriptors and packaging Web Application Archive (WAR) files.
- A binding to SOAP, including SOAP Fault handling through Java exceptions and HeaderFault processing.
- Type mappings between Java and XML datatypes.
- A service-side invocation handler mechanism used to chain together service method
- A reference implementation (RI) that provides a runtime implementation and a code generation tool, xrpcc.
- A serialization framework for marshalling and unmarshalling data between Java and XML based on soap-encoding rules. The RI from Sun includes an implementation of this framework.
JAX-RPC is a funny kind of animal. Finding the right kinds of things to write about it in the context of this book was a challenge. At the time of writing, the specification was still evolving. This chapter is based on a Version 0.6 snapshot of the specification’s first public draft, issued as part of the Winter 01 Java Web Services Developer Pack. There are no known implementations, except for the RI (which is evolving with the specification) and the Apache Axis project (which is in alpha stage and based on Version 0.5 of the specification). Therefore, many examples in this section are repurposed directly from the specification. Several areas in the specification are in flux, need more definition, and are extremely likely to change before it hits a 1.0 status. Currently, the specification is 152 pages long and has enough information in it to comprise a whole book when it’s finally finished.
In spite of its status, the JAX-RPC specification has a brief working tutorial (as do all JAX products) that walks you through installation and setup and guides you through building a simple “Hello World” example. The RI runtime requires Tomcat; its installation, code generation tool, and deployment tool are based on Ant.
Most of the specification iterates over details and rules for mapping things between Java, XML, SOAP, and WSDL—not only for infrastructure provider runtime interactions, but also to provide directives and guidelines for code generation tools. If you are building a code generation tool, you will need more than we are presenting in this book.
Considering these factors, we still chose to write about JAX-RPC because it is a significant piece of functionality that is slated for J2EE 1.4. Therefore, its “baketime” will have to be short. We’ll focus on the things that are baked and concentrate on the things that are exposed to the application developer. As the specification progresses, we will update our examples and provide new examples to go with them.