Interface SoapBody

All Superinterfaces:
SoapElement
All Known Subinterfaces:
Soap11Body, Soap12Body

public interface SoapBody extends SoapElement
Represents the Body element in a SOAP message. A SOAP body contains the payload of the message. This payload can be custom XML, or a SoapFault (but not both).

Note that the source returned by getSource() includes the SOAP Body element itself. For the contents of the body, use getPayloadSource().

Since:
1.0.0
Author:
Arjen Poutsma
See Also:
  • Method Details

    • getPayloadSource

      Source getPayloadSource()
      Returns a Source that represents the contents of the body.
      Returns:
      the message contents
      See Also:
    • getPayloadResult

      Result getPayloadResult()
      Returns a Result that represents the contents of the body.

      Calling this method removes the current content of the body.

      Returns:
      the message contents
      See Also:
    • addMustUnderstandFault

      SoapFault addMustUnderstandFault(String faultStringOrReason, Locale locale) throws SoapFaultException
      Adds a MustUnderstand fault to the body. A MustUnderstand is returned when a SOAP header with a MustUnderstand attribute is not understood.

      Adding a fault removes the current content of the body.

      Parameters:
      faultStringOrReason - the SOAP 1.1 fault string or SOAP 1.2 reason text
      locale - the language of faultStringOrReason. Optional for SOAP 1.1
      Returns:
      the created SoapFault
      Throws:
      SoapFaultException
    • addClientOrSenderFault

      SoapFault addClientOrSenderFault(String faultStringOrReason, Locale locale) throws SoapFaultException
      Adds a Client/Sender fault to the body. For SOAP 1.1, this adds a fault with a Client fault code. For SOAP 1.2, this adds a fault with a Sender code.

      Adding a fault removes the current content of the body.

      Parameters:
      faultStringOrReason - the SOAP 1.1 fault string or SOAP 1.2 reason text
      locale - the language of faultStringOrReason. Optional for SOAP 1.1
      Returns:
      the created SoapFault
      Throws:
      SoapFaultException
    • addServerOrReceiverFault

      SoapFault addServerOrReceiverFault(String faultStringOrReason, Locale locale) throws SoapFaultException
      Adds a Server/Receiver fault to the body. For SOAP 1.1, this adds a fault with a Server fault code. For SOAP 1.2, this adds a fault with a Receiver code.

      Adding a fault removes the current content of the body.

      Parameters:
      faultStringOrReason - the SOAP 1.1 fault string or SOAP 1.2 reason text
      locale - the language of faultStringOrReason. Optional for SOAP 1.1
      Returns:
      the created SoapFault
      Throws:
      SoapFaultException
    • addVersionMismatchFault

      SoapFault addVersionMismatchFault(String faultStringOrReason, Locale locale) throws SoapFaultException
      Adds a VersionMismatch fault to the body.

      Adding a fault removes the current content of the body.

      Parameters:
      faultStringOrReason - the SOAP 1.1 fault string or SOAP 1.2 reason text
      locale - the language of faultStringOrReason. Optional for SOAP 1.1
      Returns:
      the created SoapFault
      Throws:
      SoapFaultException
    • hasFault

      boolean hasFault()
      Indicates whether this body has a SoapFault.
      Returns:
      true if the body has a fault; false otherwise
    • getFault

      SoapFault getFault()
      Returns the SoapFault of this body.
      Returns:
      the SoapFault, or null if none is present