Figured it out after all. Here is the way to do it:
Node details = ((SoapFault) envelope.bodyIn).detail;
Element detEle = details.getElement(NAMESPACE, "detail");
List<Error> errorList = new ArrayList<NewConnector.Error>();
Element idEle = detEle.getElement(NAMESPACE, "error_id");
str.append("id: " + idEle.getText(0));
str.append("\n");
Integer id = Integer.valueOf(idEle.getText(0));
if (id == 2) {
// many errors
Element errors = detEle.getElement(NAMESPACE, "errors");
int errorChildCount = errors.getChildCount();
for (int i = 0; i < errorChildCount; i++) {
Object innerError = errors.getChild(i);
if (innerError instanceof Element) {
Element error_id = ((Element) innerError).getElement(
NAMESPACE, "error_id");
Element error_descrion = ((Element) innerError)
.getElement(NAMESPACE, "error_description");
Error singleError = new Error(Integer.valueOf(error_id
.getText(0)), error_descrion.getText(0));
errorList.add(singleError);
str.append(singleError.toString() + "\n");
}
}
str.append("Found " + errorList.size() + " errors.\n");
str.append("errorscount:" + errors.getChildCount());
The code obviously needs improvements, but it's just a showcase of how to get each value. Cheers