diff --git a/spring-ws-test/src/main/java/org/springframework/ws/test/support/matcher/xmlunit2/PayloadDiffMatcher.java b/spring-ws-test/src/main/java/org/springframework/ws/test/support/matcher/xmlunit2/PayloadDiffMatcher.java
index 457213511..dd2fb8933 100644
--- a/spring-ws-test/src/main/java/org/springframework/ws/test/support/matcher/xmlunit2/PayloadDiffMatcher.java
+++ b/spring-ws-test/src/main/java/org/springframework/ws/test/support/matcher/xmlunit2/PayloadDiffMatcher.java
@@ -60,6 +60,7 @@ protected Diff createDiff(Source payload) {
Document actualDocument = createDocumentFromSource(payload);
return DiffBuilder.compare(expectedDocument) //
.withTest(actualDocument) //
+ .ignoreWhitespace() //
.checkForSimilar() //
.build();
}
diff --git a/spring-ws-test/src/test/java/org/springframework/ws/test/support/matcher/xmlunit2/PayloadDiffMatcherTest.java b/spring-ws-test/src/test/java/org/springframework/ws/test/support/matcher/xmlunit2/PayloadDiffMatcherTest.java
index 8d285aa7b..7726327f2 100644
--- a/spring-ws-test/src/test/java/org/springframework/ws/test/support/matcher/xmlunit2/PayloadDiffMatcherTest.java
+++ b/spring-ws-test/src/test/java/org/springframework/ws/test/support/matcher/xmlunit2/PayloadDiffMatcherTest.java
@@ -46,6 +46,22 @@ public void match() {
verify(message);
}
+ @Test
+ public void matchIgnoringWhitespace() {
+
+ String xml = "true";
+ String xmlWithAdditionalWhitespace = " true ";
+ WebServiceMessage message = createMock(WebServiceMessage.class);
+ expect(message.getPayloadSource()).andReturn(new StringSource(xml)).times(2);
+ replay(message);
+
+ PayloadDiffMatcher matcher = new PayloadDiffMatcher(new StringSource(xmlWithAdditionalWhitespace));
+ matcher.match(message);
+
+ verify(message);
+ }
+
+
@Test
public void nonMatch() {