Class SaajSoapMessage

All Implemented Interfaces:
FaultAwareWebServiceMessage, MimeMessage, SoapMessage, WebServiceMessage

public class SaajSoapMessage extends AbstractSoapMessage
SAAJ-specific implementation of the SoapMessage interface. Created via the SaajSoapMessageFactory, wraps a SOAPMessage.
Since:
1.0.0
Author:
Arjen Poutsma, Greg Turnquist
See Also:
  • SOAPMessage
  • Constructor Details

    • SaajSoapMessage

      public SaajSoapMessage(jakarta.xml.soap.SOAPMessage soapMessage)
      Create a new SaajSoapMessage based on the given SAAJ SOAPMessage.
      Parameters:
      soapMessage - the SAAJ SOAPMessage
    • SaajSoapMessage

      public SaajSoapMessage(jakarta.xml.soap.SOAPMessage soapMessage, jakarta.xml.soap.MessageFactory messageFactory)
      Create a new SaajSoapMessage based on the given SAAJ SOAPMessage.
      Parameters:
      soapMessage - the SAAJ SOAPMessage
      messageFactory - the SAAJ message factory
    • SaajSoapMessage

      public SaajSoapMessage(jakarta.xml.soap.SOAPMessage soapMessage, boolean langAttributeOnSoap11FaultString)
      Create a new SaajSoapMessage based on the given SAAJ SOAPMessage.
      Parameters:
      soapMessage - the SAAJ SOAPMessage
      langAttributeOnSoap11FaultString - whether a xml:lang attribute is allowed on SOAP 1.1 <faultstring> elements
    • SaajSoapMessage

      public SaajSoapMessage(jakarta.xml.soap.SOAPMessage soapMessage, boolean langAttributeOnSoap11FaultString, jakarta.xml.soap.MessageFactory messageFactory)
      Create a new SaajSoapMessage based on the given SAAJ SOAPMessage.
      Parameters:
      soapMessage - the SAAJ SOAPMessage
      langAttributeOnSoap11FaultString - whether a xml:lang attribute is allowed on SOAP 1.1 <faultstring> elements
      messageFactory - the message factory
  • Method Details

    • getSaajMessage

      public jakarta.xml.soap.SOAPMessage getSaajMessage()
      Return the SAAJ SOAPMessage that this SaajSoapMessage is based on.
    • setSaajMessage

      public void setSaajMessage(jakarta.xml.soap.SOAPMessage soapMessage)
      Sets the SAAJ SOAPMessage that this SaajSoapMessage is based on.
    • getEnvelope

      public SoapEnvelope getEnvelope()
      Description copied from interface: SoapMessage
      Returns the SoapEnvelope associated with this SoapMessage.
    • getSoapAction

      public String getSoapAction()
      Description copied from interface: SoapMessage
      Get the SOAP Action for this message, or null if not present.
      Returns:
      the SOAP Action.
    • setSoapAction

      public void setSoapAction(String soapAction)
      Description copied from interface: SoapMessage
      Sets the SOAP Action for this message.
      Parameters:
      soapAction - the SOAP Action.
    • getDocument

      public Document getDocument()
      Description copied from interface: SoapMessage
      Returns this message as a Document. Depending on the underlying implementation, this Document may be 'live' or not.
      Returns:
      this soap message as a DOM document
    • setDocument

      public void setDocument(Document document)
      Description copied from interface: SoapMessage
      Sets the contents of the message to the given Document.
      Parameters:
      document - the soap message as a DOM document
    • writeTo

      public void writeTo(OutputStream outputStream) throws IOException
      Description copied from interface: WebServiceMessage
      Writes the entire message to the given output stream.

      If the given stream is an instance of TransportOutputStream, the corresponding headers will be written as well.

      Parameters:
      outputStream - the stream to write to
      Throws:
      IOException - if an I/O exception occurs
    • isXopPackage

      public boolean isXopPackage()
      Description copied from interface: MimeMessage
      Indicates whether this message is a XOP package.
      Returns:
      true when the constraints specified in Identifying XOP Documents are met.
      See Also:
    • convertToXopPackage

      public boolean convertToXopPackage()
      Description copied from interface: MimeMessage
      Turns this message into a XOP package.
      Returns:
      true when the message is a XOP package
      See Also:
    • getAttachments

      public Iterator<Attachment> getAttachments() throws AttachmentException
      Description copied from interface: MimeMessage
      Returns an Iterator over all Attachment objects that are part of this message.
      Returns:
      an iterator over all attachments
      Throws:
      AttachmentException - in case of errors
      See Also:
    • getAttachment

      public Attachment getAttachment(String contentId)
      Description copied from interface: MimeMessage
      Returns the Attachment with the specified content Id.
      Returns:
      the attachment with the specified content id; or null if it cannot be found
    • addAttachment

      public Attachment addAttachment(String contentId, jakarta.activation.DataHandler dataHandler)
      Description copied from interface: MimeMessage
      Add an attachment to the message, taking the content from a DataHandler.
      dataHandler - the data handler to take the content from
      Returns:
      the added attachment
    • toString

      public String toString()
      Overrides:
      toString in class Object