Java API for XML Messaging
The Java API for XML Messaging (JAXM) makes it possible for developers to do XML messaging using the Java platform. By simply making method calls using the JAXM API, you can create and send XML messages over the Internet. This chapter will help you learn how to use the JAXM API.
The JAXM API conforms to the Simple Object Access Protocol (SOAP) 1.1 specification and the SOAP with Attachments specification. The complete JAXM API is presented in two packages:
javax.xml.soap-- the package defined in the SOAP with Attachments API for Java (SAAJ) 1.1 specification. This is the basic package for SOAP messaging, which contains the API for creating and populating a SOAP message. This package has all the API necessary for sending request-response messages. (Request-response messages are explained in SOAPConnection.) The current version is SAAJ 1.1_02.
javax.xml.messaging-- the package defined in the JAXM 1.1 specification. This package contains the API needed for using a messaging provider and thus for being able to send one-way messages. (One-way messages are explained in ProviderConnection.)The current version is JAXM 1.1_01.
Originally, both packages were defined in the JAXM 1.0 specification. The
javax.xml.soappackage was separated out and expanded into the SAAJ 1.1 specification so that now it has no dependencies on the
javax.xml.messagingpackage and thus can be used independently. The SAAJ API also makes it easier to create XML fragments, which is especially helpful for developing JAX-RPC implementations.
javax.xml.messagingpackage, defined in the JAXM 1.1 specification, maintains its dependency on the
java.xml.soappackage because the
soappackage contains the API used for creating and manipulating SOAP messages. In other words, a client sending request-response messages can use just the
javax.xml.soapAPI. A Web service or client that uses one-way messaging will need to use API from both the
Note: In this document, "JAXM 1.1_01 API" refers to the API in the
javax.xml.messagingpackage; "SAAJ API" refers to the API in the
javax.xml.soappackage. "JAXM API" is a more generic term, referring to all of the API used for SOAP messaging, that is, the API in both packages.
In addition to stepping you through how to use the JAXM API, this chapter gives instructions for running the sample JAXM applications included with the Java WSDP as a way to help you get started. You may prefer to go through both the overview and tutorial before running the samples to make it easier to understand what the sample applications are doing, or you may prefer to explore the samples first. The overview gives some of the conceptual background behind the JAXM API to help you understand why certain things are done the way they are. The tutorial shows you how to use the basic JAXM API, giving examples and explanations of the more commonly used features. Finally, the code examples in the last part of the tutorial show how to build an application.
In This Chapter
- Overview of JAXM
- Messaging Providers
- Running the Samples
- The Sample Programs
- Source Code for the Samples
- Client without a Messaging Provider
- Client with a Messaging Provider
- Adding Attachments
- SOAP Faults
- Code Examples
- UddiPing.java and MyUddiPing.java
- Further Information
This tutorial contains information on the 1.0 version of the Java Web Services Developer Pack.
All of the material in The Java Web Services Tutorial is copyright-protected and may not be published in other works without express written permission from Sun Microsystems.