SAAJ SOAPMessage Structure and Classes/Interfaces

This section describes the SAAJ SOAPMessage structure, classes and interfaces that allows you to manage contents of a SOAPMessage object.

In the previous section, we learned how to create an empty SOAPMessage object. Now we want to know to insert contents into a SOAPMessage object. To do this, we need to understand the internal structure of a SOAPMessage object and what classes are used to represent different parts of a SOAPMessage object.

The high-level structure of a SOAPMessage object is well presented by this picture from the "The Java EE 5Tutorial" book by Sun Microsystems.
SOAPMessage Internal Structure

This picture shows a SOAPMessage object with a SOAP message and 2 attachments represented as various objects and organized in this structure:

A SOAPMessage object - A container for a SOAP message and attachments

  A SOAPPart object - A container for a SOAP header and a SOAP body
  
    A SOAPEnvelope object - Represents a SOAP envelope
      A SOAPHeader object - Represents a SOAP header
        SOAP Headers
      A SOAPBody object - Represents a SOAP body
        SOAP Content

  A AttachmentPart object - A container for an attachment
    MIME Headers
    Content

  A AttachmentPart object - A container for an attachment
    MIME Headers
    Content

Interfaces listed below and their methods will allow you to manage various objects contained in a SOAPMessage object:

javax.xml.soap.SOAPPart -
   A class representing container for a SOAP message and attachments
   
javax.xml.soap.AttachmentPart - 
   A class representing a single attachment
   
javax.xml.soap.SOAPEnvelope - 
   An interface representing the SOAP envelope
   
javax.xml.soap.SOAPHeader - 
   An interface representing the SOAP header

javax.xml.soap.SOAPBody - 
   An interface representing the SOAP body

Both SOAPHeader and SOAPBody interfaces inherits org.w3c.dom.Element, org.w3c.dom.Node, and javax.xml.soap.SOAPElement interfaces, which provide more methods to help you manage contents of the SOAP header and the SOAP body.

Last update: 2009.

Table of Contents

 About This Book

 Introduction to Web Service

 Introduction to SOAP (Simple Object Access Protocol)

 SOAP Message Structure

 SOAP Message Transmission and Processing

 SOAP Data Model

 SOAP Encoding

 SOAP RPC Presentation

 SOAP Properties Model

 SOAP Message Exchange Patterns

 SOAP HTTP Binding

 SOAP Perl Implementations

 SOAP PHP Implementations

 SOAP Java Implementations

 Perl SOAP::Lite - SOAP Server-Client Communication Module

 Perl Socket Test Program for HTTP and SOAP

 Perl SOAP::Lite for GetSpeech SOAP 1.1 Web Service

 Perl SOAP::Lite 0.710 for SOAP 1.2 Web Services

 Perl SOAP::Lite 0.710 for WSDL

 PHP SOAP Extension Client Programs

 PHP SOAP Extension Server Programs

 Java Socket and HttpURLConnection for SOAP

SAAJ - SOAP with Attachments API for Java

 SAAJ API 1.3 Classes and Interfaces Overview

 SAAJ API and Default Implementation in JDK 1.6.0

 SAAJ API Reference Implementation 1.3.4

 First SOAPConnection Test Program

 Creating SOAPConnection and SOAPMessage Objects

SAAJ SOAPMessage Structure and Classes/Interfaces

 Populating the SOAP Body with Request XML Elements

 Don't Use xml* as namespace Prefix

 addHeader() - Setting SOAPAction Header Line

 Calling GetSpeech SOAP 1.1 with SAAJ

 SOAPConstants.SOAP_1_2_PROTOCOL

 Calling GetSpeech SOAP 1.2 with SAAJ

 SoapUI - SOAP Web Service Testing Tool

 WS-Security - SOAP Message Security Extension

 WS-Security X.509 Certificate Token

 Web Services and SOAP Terminology

 References

 PDF Printing Version