Previous section   Next section
Package javax.xml.soap

SAAJ 1.1; JWSDP 1.0, J2EE 1.4

The javax.xml.soap package contains the classes and interfaces that make up the Soap with Attachments API for Java (SAAJ). This package can be divided into two major parts: a small number of classes and interfaces that obtain a SOAP message and send it, and a much larger set that deal with the structure of the message itself.

In order to send a message, you need to get an instance of the SOAPConnection class. As is the case with most of the classes in this package, this class is abstract in order to allow vendors to provide their own implementations. You can obtain a SOAPConnection object from the SOAPConnectionFactory class, which is another abstract class that you can get an instance of by calling its newInstance( ) method. A SOAP message is represented by the SOAPMessage class, which can be obtained from a MessageFactory.

SOAP messages are built from elements that are represented in the API by the SOAPElement interface. This interface provides methods that allow you to add other elements and text nodes to form a tree structure that is serialized to XML form when the message is transmitted. Similarly, on receipt, a SOAP message is converted from XML form to a SOAPMessage consisting of SOAPElements and Text nodes. SOAPElement has various subinterfaces that represent different parts of the SOAP message, such as SOAPHeader, SOAPBody, and SOAPFault.

The body of a SOAP message can only contain valid XML data. Non-XML data can be included by adding one or more attachments. SAAJ supports the use of attachments that contain MIME-encoded data. To add such an attachment, create an AttachmentPart object, specifying the data content and its MIME type, and attach it to the message.

Interfaces

public interface Detail extends SOAPFaultElement;
public interface DetailEntry extends SOAPElement;
public interface Name;
public interface Node;
public interface SOAPBody extends SOAPElement;
public interface SOAPBodyElement extends SOAPElement;
public interface SOAPConstants;
public interface SOAPElement extends Node;
public interface SOAPEnvelope extends SOAPElement;
public interface SOAPFault extends SOAPBodyElement;
public interface SOAPFaultElement extends SOAPElement;
public interface SOAPHeader extends SOAPElement;
public interface SOAPHeaderElement extends SOAPElement;
public interface Text extends Node;

Classes

public abstract class AttachmentPart;
public abstract class MessageFactory;
public class MimeHeader;
public class MimeHeaders;
public abstract class SOAPConnection;
public abstract class SOAPConnectionFactory;
public class SOAPElementFactory;
public abstract class SOAPFactory;
public abstract class SOAPMessage;
public abstract class SOAPPart;

Exceptions

public class SOAPException extends Exception;

  Previous section   Next section