Interface SoapBody
- All Superinterfaces:
SoapElement
- All Known Subinterfaces:
Soap11Body, Soap12Body
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
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionaddClientOrSenderFault(String faultStringOrReason, Locale locale) Adds aClient/Senderfault to the body.addMustUnderstandFault(String faultStringOrReason, Locale locale) Adds aMustUnderstandfault to the body.addServerOrReceiverFault(String faultStringOrReason, Locale locale) Adds aServer/Receiverfault to the body.addVersionMismatchFault(String faultStringOrReason, Locale locale) Adds aVersionMismatchfault to the body.@Nullable SoapFaultgetFault()Returns theSoapFaultof this body.Returns aResultthat represents the contents of the body.@Nullable SourceReturns aSourcethat represents the contents of the body.booleanhasFault()Indicates whether this body has aSoapFault.Methods inherited from interface SoapElement
addAttribute, addNamespaceDeclaration, getAllAttributes, getAttributeValue, getName, getSource, removeAttribute
-
Method Details
-
getPayloadSource
@Nullable Source getPayloadSource()Returns aSourcethat represents the contents of the body.- Returns:
- the message contents
- See Also:
-
getPayloadResult
Result getPayloadResult()Returns aResultthat 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 aMustUnderstandfault to the body. AMustUnderstandis returned when a SOAP header with aMustUnderstandattribute 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 textlocale- 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 aClient/Senderfault to the body. For SOAP 1.1, this adds a fault with aClientfault code. For SOAP 1.2, this adds a fault with aSendercode.Adding a fault removes the current content of the body.
- Parameters:
faultStringOrReason- the SOAP 1.1 fault string or SOAP 1.2 reason textlocale- 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 aServer/Receiverfault to the body. For SOAP 1.1, this adds a fault with aServerfault code. For SOAP 1.2, this adds a fault with aReceivercode.Adding a fault removes the current content of the body.
- Parameters:
faultStringOrReason- the SOAP 1.1 fault string or SOAP 1.2 reason textlocale- 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 aVersionMismatchfault 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 textlocale- the language of faultStringOrReason. Optional for SOAP 1.1- Returns:
- the created
SoapFault - Throws:
SoapFaultException
-
hasFault
boolean hasFault()Indicates whether this body has aSoapFault.- Returns:
trueif the body has a fault;falseotherwise
-
getFault
@Nullable SoapFault getFault()Returns theSoapFaultof this body.- Returns:
- the
SoapFault, ornullif none is present
-