Package org.springframework.ws.soap
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
/Sender
fault to the body.addMustUnderstandFault
(String faultStringOrReason, Locale locale) Adds aMustUnderstand
fault to the body.addServerOrReceiverFault
(String faultStringOrReason, Locale locale) Adds aServer
/Receiver
fault to the body.addVersionMismatchFault
(String faultStringOrReason, Locale locale) Adds aVersionMismatch
fault to the body.@Nullable SoapFault
getFault()
Returns theSoapFault
of this body.Returns aResult
that represents the contents of the body.@Nullable Source
Returns aSource
that represents the contents of the body.boolean
hasFault()
Indicates whether this body has aSoapFault
.Methods inherited from interface org.springframework.ws.soap.SoapElement
addAttribute, addNamespaceDeclaration, getAllAttributes, getAttributeValue, getName, getSource, removeAttribute
-
Method Details
-
getPayloadSource
@Nullable Source getPayloadSource()Returns aSource
that represents the contents of the body.- Returns:
- the message contents
- See Also:
-
getPayloadResult
Result getPayloadResult()Returns aResult
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 aMustUnderstand
fault to the body. AMustUnderstand
is returned when a SOAP header with aMustUnderstand
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 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
/Sender
fault to the body. For SOAP 1.1, this adds a fault with aClient
fault code. For SOAP 1.2, this adds a fault with aSender
code.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
/Receiver
fault to the body. For SOAP 1.1, this adds a fault with aServer
fault code. For SOAP 1.2, this adds a fault with aReceiver
code.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 aVersionMismatch
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 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:
true
if the body has a fault;false
otherwise
-
getFault
@Nullable SoapFault getFault()Returns theSoapFault
of this body.- Returns:
- the
SoapFault
, ornull
if none is present
-