//figureout the soap version
boolean isSoap11 = soapFault.getNamespace().getNamespaceURI().equals(
SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
SOAPFaultCode soapCode = soapFault.getCode();
QName codeQName = null;
if (isSoap11) {
codeQName = soapCode.getTextAsQName();
} else {
codeQName = soapCode.getValue().getTextAsQName();
}
XMLFaultCode code = XMLFaultCode.fromQName(codeQName);
// Get the primary reason text
// TODO what if this fails
SOAPFaultReason soapReason = soapFault.getReason();
String text = null;
String lang = null;
List soapTexts = null;
if (isSoap11) {
text = soapReason.getText();
} else {
soapTexts = soapReason.getAllSoapTexts();
SOAPFaultText reasonText = (SOAPFaultText)soapTexts.get(0);
text = reasonText.getText();
lang = reasonText.getLang();
}
XMLFaultReason reason = new XMLFaultReason(text, lang);
// Construct the XMLFault from the required information (code, reason, detail blocks)
XMLFault xmlFault = new XMLFault(code, reason, detailBlocks);
// Add the secondary fault information
// Get the SubCodes
SOAPFaultSubCode soapSubCode = soapCode.getSubCode();
if (soapSubCode != null) {
List<QName> list = new ArrayList<QName>();
// Walk the nested sub codes and collect the qnames
while (soapSubCode != null) {