diff --git a/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/config/WebServiceHandlerParser.java b/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/config/WebServiceHandlerParser.java
index 7c9b905900..7ff0aeed12 100644
--- a/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/config/WebServiceHandlerParser.java
+++ b/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/config/WebServiceHandlerParser.java
@@ -70,6 +70,10 @@ public class WebServiceHandlerParser extends AbstractSingleBeanDefinitionParser
builder.addConstructorArgReference(sourceExtractorRef);
}
}
+ String requestCallbackRef = element.getAttribute("request-callback");
+ if (StringUtils.hasText(requestCallbackRef)) {
+ builder.addPropertyReference("requestCallback", requestCallbackRef);
+ }
}
}
diff --git a/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/config/spring-integration-ws-1.0.xsd b/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/config/spring-integration-ws-1.0.xsd
index 421e68ce4e..a2113a1041 100644
--- a/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/config/spring-integration-ws-1.0.xsd
+++ b/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/config/spring-integration-ws-1.0.xsd
@@ -31,6 +31,7 @@
+
diff --git a/org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/StubWebServiceMessageCallback.java b/org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/StubWebServiceMessageCallback.java
new file mode 100644
index 0000000000..9113412783
--- /dev/null
+++ b/org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/StubWebServiceMessageCallback.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2002-2008 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.integration.ws.config;
+
+import java.io.IOException;
+
+import javax.xml.transform.TransformerException;
+
+import org.springframework.ws.WebServiceMessage;
+import org.springframework.ws.client.core.WebServiceMessageCallback;
+
+/**
+ * @author Mark Fisher
+ */
+public class StubWebServiceMessageCallback implements WebServiceMessageCallback {
+
+ public void doWithMessage(WebServiceMessage message) throws IOException, TransformerException {
+ }
+
+}
diff --git a/org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/WebServiceHandlerParserTests.java b/org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/WebServiceHandlerParserTests.java
index 34582569fa..afc03b69c7 100644
--- a/org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/WebServiceHandlerParserTests.java
+++ b/org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/WebServiceHandlerParserTests.java
@@ -29,6 +29,7 @@ import org.springframework.integration.ws.handler.SimpleWebServiceHandler;
import org.springframework.oxm.Marshaller;
import org.springframework.oxm.Unmarshaller;
import org.springframework.ws.client.core.SourceExtractor;
+import org.springframework.ws.client.core.WebServiceMessageCallback;
/**
* @author Mark Fisher
@@ -56,6 +57,17 @@ public class WebServiceHandlerParserTests {
assertEquals(sourceExtractor, accessor.getPropertyValue("sourceExtractor"));
}
+ @Test
+ public void testSimpleWebServiceHandlerWithCustomRequestCallback() {
+ ApplicationContext context = new ClassPathXmlApplicationContext(
+ "simpleWebServiceHandlerParserTests.xml", this.getClass());
+ MessageHandler handler = (MessageHandler) context.getBean("handlerWithCustomRequestCallback");
+ assertEquals(SimpleWebServiceHandler.class, handler.getClass());
+ DirectFieldAccessor accessor = new DirectFieldAccessor(handler);
+ WebServiceMessageCallback callback = (WebServiceMessageCallback) context.getBean("requestCallback");
+ assertEquals(callback, accessor.getPropertyValue("requestCallback"));
+ }
+
@Test
public void testWebServiceHandlerWithAllInOneMarshaller() {
ApplicationContext context = new ClassPathXmlApplicationContext(
@@ -71,7 +83,7 @@ public class WebServiceHandlerParserTests {
}
@Test
- public void testWebServiceTargetAdapterWithSeparateMarshallerAndUnmarshaller() {
+ public void testWebServiceHandlerWithSeparateMarshallerAndUnmarshaller() {
ApplicationContext context = new ClassPathXmlApplicationContext(
"marshallingWebServiceHandlerParserTests.xml", this.getClass());
MessageHandler handler = (MessageHandler) context.getBean("handlerWithSeparateMarshallerAndUnmarshaller");
@@ -85,4 +97,15 @@ public class WebServiceHandlerParserTests {
assertEquals(unmarshaller, templateAccessor.getPropertyValue("unmarshaller"));
}
+ @Test
+ public void testMarshallingWebServiceHandlerWithCustomRequestCallback() {
+ ApplicationContext context = new ClassPathXmlApplicationContext(
+ "marshallingWebServiceHandlerParserTests.xml", this.getClass());
+ MessageHandler handler = (MessageHandler) context.getBean("handlerWithCustomRequestCallback");
+ assertEquals(MarshallingWebServiceHandler.class, handler.getClass());
+ DirectFieldAccessor accessor = new DirectFieldAccessor(handler);
+ WebServiceMessageCallback callback = (WebServiceMessageCallback) context.getBean("requestCallback");
+ assertEquals(callback, accessor.getPropertyValue("requestCallback"));
+ }
+
}
diff --git a/org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/marshallingWebServiceHandlerParserTests.xml b/org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/marshallingWebServiceHandlerParserTests.xml
index 3d25f733b3..1bac1d75cc 100644
--- a/org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/marshallingWebServiceHandlerParserTests.xml
+++ b/org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/marshallingWebServiceHandlerParserTests.xml
@@ -12,9 +12,14 @@
marshaller="marshallerAndUnmarshaller"/>
+ uri="http://example.org"
+ marshaller="marshaller"
+ unmarshaller="unmarshaller"/>
+
+
@@ -22,4 +27,6 @@
+
+
diff --git a/org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/simpleWebServiceHandlerParserTests.xml b/org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/simpleWebServiceHandlerParserTests.xml
index 5ee5dffd9c..1513252654 100644
--- a/org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/simpleWebServiceHandlerParserTests.xml
+++ b/org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/simpleWebServiceHandlerParserTests.xml
@@ -14,6 +14,12 @@
uri="http://example.org"
source-extractor="sourceExtractor"/>
+
+
+
+