220.127.116.11. JAX-RPC and SAAJ: Using and writing web services
Web services have created quite a stir in the enterprise development domain by promising
a new idiom for writing and using distributed services. Web services refer to services that
are callable using an XML-based protocol and transmitted over HTTP, SMTP, and other
communication protocols. Web services are exciting because, like CORBA, they provide a
platform-independent approach to distributed computing; since they depend on
ubiquitous formats and protocols (such as XML and HTTP), the endpoints in web service
architectures can be implemented in any platform or language that supports these
protocols. In other words, web services can be produced and consumed by nearly all
modern programming languages and on all platforms.
But web services have some additional advantages that RMI and CORBA do not. Since the
overall distributed computing architecture is generic and extensible, web services provide
much more flexibility in terms of the physical implementation of the web services and their
surrounding runtime support. A web service engine can be a full-blown application server
with failover and load-balancing or a tiny runtime process on a handheld device.
Programming models, APIs, object models, and the like are left up to the implementation
platform, allowing them to be optimized for the particular environment.
The fundamental standard protocols used in web services today are SOAP (Simple Object
Access Protocol) for interprocess communications and WSDL (Web Services Descriptor
Language) for describing web services. In the Java community, a suite of standard Java
APIs have been defined to help developers build and use web services. We discuss the two
most important ones in this book: the Java API for XML Remote Procedure Calls (JAXRPC)
(JSR 101, JSR 224) and the SOAP with Attachments API for Java (SAAJ).
SAAJ defines a standard API for basic, low-level messaging using SOAP. On top of this, JAXRPC
provides a standard API for interacting with web services using a remote method
invocation paradigm in which a request to a web service is expected to result in an
immediate response. Both of these APIs are covered in the web services tutorial in Chapter
12.Java Enterprise in a Nutshell, 3rd Edition Page 19 Return to Table of Contents