diff --git a/core/src/main/java/org/springframework/ws/soap/axiom/AxiomSoapFaultDetail.java b/core/src/main/java/org/springframework/ws/soap/axiom/AxiomSoapFaultDetail.java
index 02717d71..9a77116e 100644
--- a/core/src/main/java/org/springframework/ws/soap/axiom/AxiomSoapFaultDetail.java
+++ b/core/src/main/java/org/springframework/ws/soap/axiom/AxiomSoapFaultDetail.java
@@ -51,7 +51,7 @@ class AxiomSoapFaultDetail extends AxiomSoapElement implements SoapFaultDetail {
}
public Iterator getDetailEntries() {
- return new AxiomSoapFaultDetailElementIterator(getAxiomFaultDetail().getAllDetailEntries());
+ return new AxiomSoapFaultDetailElementIterator(getAxiomFaultDetail().getChildElements());
}
public Result getResult() {
diff --git a/core/src/test/java/org/springframework/ws/soap/axiom/AxiomSoapFaultDetailTest.java b/core/src/test/java/org/springframework/ws/soap/axiom/AxiomSoapFaultDetailTest.java
new file mode 100644
index 00000000..9683d994
--- /dev/null
+++ b/core/src/test/java/org/springframework/ws/soap/axiom/AxiomSoapFaultDetailTest.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2007 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.ws.soap.axiom;
+
+import java.io.StringReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+import org.apache.axiom.soap.SOAPMessage;
+import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
+import org.springframework.ws.soap.SoapFault;
+import org.springframework.ws.soap.SoapFaultDetail;
+
+/** @author Arjen Poutsma */
+public class AxiomSoapFaultDetailTest extends TestCase {
+
+ private static final String FAILING_FAULT =
+ "\n " + "\n " +
+ "\n " + "Client\n " +
+ "Client Error\n " + "\n " +
+ "\n " +
+ "\n " + "" + "" +
+ "" + "" + "";
+
+ private static final String SUCCEEDING_FAULT =
+ "\n " + "\n " +
+ "\n " + "Client\n " +
+ "Client Error\n " + "" +
+ "\n " +
+ "\n " + "" + "" +
+ "" + "" + "";
+
+ private AxiomSoapMessage failingMessage;
+
+ private AxiomSoapMessage succeedingMessage;
+
+ protected void setUp() throws Exception {
+ XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(FAILING_FAULT));
+ StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(parser);
+ SOAPMessage soapMessage = builder.getSoapMessage();
+
+ failingMessage = new AxiomSoapMessage(soapMessage, null, false);
+
+ parser = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(SUCCEEDING_FAULT));
+ builder = new StAXSOAPModelBuilder(parser);
+ soapMessage = builder.getSoapMessage();
+
+ succeedingMessage = new AxiomSoapMessage(soapMessage, null, false);
+
+ }
+
+ public void testGetDetailEntriesWorksWithWhitespaceNodes() throws Exception {
+ SoapFault fault = failingMessage.getSoapBody().getFault();
+ assertNotNull("Fault is null", fault);
+ assertNotNull("Fault detail is null", fault.getFaultDetail());
+ SoapFaultDetail detail = fault.getFaultDetail();
+ assertTrue("No next detail entry present", detail.getDetailEntries().hasNext());
+ detail.getDetailEntries().next();
+
+ }
+
+ public void testGetDetailEntriesWorksWithoutWhitespaceNodes() throws Exception {
+ SoapFault fault = succeedingMessage.getSoapBody().getFault();
+ assertNotNull("Fault is null", fault);
+ assertNotNull("Fault detail is null", fault.getFaultDetail());
+ SoapFaultDetail detail = fault.getFaultDetail();
+ assertTrue("No next detail entry present", detail.getDetailEntries().hasNext());
+ detail.getDetailEntries().next();
+ }
+
+}
\ No newline at end of file