* Otherwise set the Fault/Code/Value to env:Sender and the Fault/Code/Subcode/Value
* as the fault code from the WSSecurityException.
*/
private SoapFault
createSoapFault(org.apache.cxf.message.Message message, SoapVersion version, WSSecurityException e) {
SoapFault fault;
String errorMessage = null;
if (MessageUtils.isRequestor(message)) {
errorMessage = e.getMessage();
} else {
errorMessage = WSS4JUtils.getSafeExceptionMessage(e);
if (errorMessage == null) {
errorMessage = e.getMessage();
}
}
javax.xml.namespace.QName faultCode = e.getFaultCode();
if (version.getVersion() == 1.1 && faultCode != null) {
fault = new SoapFault(errorMessage, e, faultCode);
} else {
fault = new SoapFault(errorMessage, e, version.getSender());
if (version.getVersion() != 1.1 && faultCode != null) {
fault.setSubCode(faultCode);
}
}
return fault;
}