// Axis2 SAAJ stores the acutal faultcode text under a SOAPFaultValue object, so we have to
// get that and add it as a text node under the original element.
Node value = se.getFirstChild();
if (value != null && value instanceof org.apache.axis2.saaj.SOAPElementImpl) {
org.apache.axis2.saaj.SOAPElementImpl valueElement = (org.apache.axis2.saaj.SOAPElementImpl) value;
ElementImpl e = valueElement.getElement();
String content = e.getText();
SOAPElement child = fault.addChildElement(new QName(se.getNamespaceURI(), SOAP11Constants.SOAP_FAULT_CODE_LOCAL_NAME));
child.addTextNode(content);
se.detachNode();
}
}
else if (se.getLocalName().equals(SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME)) {
if (log.isDebugEnabled()) {
log.debug("Converting: detail");
}
se.setElementQName(new QName(se.getNamespaceURI(), SOAP11Constants.SOAP_FAULT_DETAIL_LOCAL_NAME));
}
else if (se.getLocalName().equals(SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME)) {
if (log.isDebugEnabled()) {
log.debug("Converting: faultstring");
}
se.setElementQName(new QName(se.getNamespaceURI(), SOAP11Constants.SOAP_FAULT_STRING_LOCAL_NAME));
// Axis2 SAAJ stores the acutal faultstring text under a SOAPFaultValue object, so we have to
// get that and add it as a text node under the original element.
Node value = se.getFirstChild();
if (value != null && value instanceof org.apache.axis2.saaj.SOAPElementImpl) {
org.apache.axis2.saaj.SOAPElementImpl valueElement = (org.apache.axis2.saaj.SOAPElementImpl) value;
ElementImpl e = valueElement.getElement();
String content = e.getText();
SOAPElement child = fault.addChildElement(new QName(se.getNamespaceURI(), SOAP11Constants.SOAP_FAULT_STRING_LOCAL_NAME));
child.addTextNode(content);
se.detachNode();
}
}
}
}
} catch (SOAPException e) {
if (log.isDebugEnabled()) {
log.debug("An error occured while converting fault elements: " + e.getMessage());
}
throw ExceptionFactory.makeWebServiceException(e);
}
}