Description
There is a use case where the implementation needs to remove the contents of the SOAPBody.
However there is a flag within the SOAPBodyImpl which checks whether the SOAPBody contains a SOAPFault, and this flag is not updated with the removal of contents from under the SOAPBody.
The API we use is as follows:
to empty the contents of the SOAPBody
----------------------------------
SOAPBody soapBody = envelope.getBody();
Iterator<OMNode> iter = soapBody.getChildren();
while (iter.hasNext()){
iter.next().detach();
}
-----------------------------------
to add SOAPFault
--------------------------------
((SOAPEnvelope)soapMessage).getBody().addFault();
--------------------------------
So basically the issue was the flag wasn't getting updated when we empty a SOAP message and then add the SOAPFault.
My recommendation will be not to use the fault flag in the SOAP body at all, and always check the actual everytime the call is made. This will save us from any sort of non-consistent state between the flag and the actual content.