diff --git a/org.springframework.integration.samples/src/main/java/org/springframework/integration/samples/ws/WebServiceDemo.java b/org.springframework.integration.samples/src/main/java/org/springframework/integration/samples/ws/WebServiceDemo.java
index 5abfc8eb1f..7af7bd2353 100644
--- a/org.springframework.integration.samples/src/main/java/org/springframework/integration/samples/ws/WebServiceDemo.java
+++ b/org.springframework.integration.samples/src/main/java/org/springframework/integration/samples/ws/WebServiceDemo.java
@@ -20,34 +20,33 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.channel.MessageChannel;
import org.springframework.integration.message.GenericMessage;
import org.springframework.integration.message.Message;
-import org.springframework.integration.ws.adapter.AbstractWebServiceTargetAdapter;
+import org.springframework.integration.ws.handler.AbstractWebServiceHandler;
/**
- * Demonstrating a web service invocation through a Web Service Target.
+ * Demonstrating a web service invocation through a Web Service MessageHandler.
*
* @author Marius Bogoevici
*/
public class WebServiceDemo {
public static void main(String[] args) {
- ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("temperatureConversion.xml",
- WebServiceDemo.class);
+ ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("temperatureConversion.xml", WebServiceDemo.class);
context.start();
-
- // Compose the XML message according to the server's schema
- String requestMessage = "" +
- " 90.0" +
- " ";
-
- // Prepare the Message object
- Message message = new GenericMessage(requestMessage);
- // In this case the service expects a SoapAction header
- message.getHeader().setProperty(AbstractWebServiceTargetAdapter.SOAP_ACTION_PROPERTY_KEY, "http://tempuri.org/FahrenheitToCelsius");
- // Set the return address for the message - the response message will be returned on this channel
- message.getHeader().setReturnAddress("celsiusChannel");
-
- ((MessageChannel)context.getBean("fahrenheitChannel")).send(message);
- }
-
-}
+ // Compose the XML message according to the server's schema
+ String requestMessage =
+ "" +
+ " 90.0" +
+ "";
+
+ // Create the Message object
+ Message message = new GenericMessage(requestMessage);
+
+ // In this case the service expects a SoapAction header
+ message.getHeader().setProperty(AbstractWebServiceHandler.SOAP_ACTION_PROPERTY_KEY, "http://tempuri.org/FahrenheitToCelsius");
+
+ // Send the Message to the handler's input channel
+ ((MessageChannel) context.getBean("fahrenheitChannel")).send(message);
+ }
+
+}
diff --git a/org.springframework.integration.samples/src/main/java/org/springframework/integration/samples/ws/temperatureConversion.xml b/org.springframework.integration.samples/src/main/java/org/springframework/integration/samples/ws/temperatureConversion.xml
index 1f5d21129a..fb23cdac85 100644
--- a/org.springframework.integration.samples/src/main/java/org/springframework/integration/samples/ws/temperatureConversion.xml
+++ b/org.springframework.integration.samples/src/main/java/org/springframework/integration/samples/ws/temperatureConversion.xml
@@ -1,27 +1,30 @@
-
-
+
-
-
-
-
+
+
-
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
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
new file mode 100644
index 0000000000..7c9b905900
--- /dev/null
+++ b/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/config/WebServiceHandlerParser.java
@@ -0,0 +1,75 @@
+/*
+ * 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 org.w3c.dom.Element;
+
+import org.springframework.beans.factory.support.BeanDefinitionBuilder;
+import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
+import org.springframework.beans.factory.xml.ParserContext;
+import org.springframework.integration.ConfigurationException;
+import org.springframework.integration.ws.handler.MarshallingWebServiceHandler;
+import org.springframework.integration.ws.handler.SimpleWebServiceHandler;
+import org.springframework.util.StringUtils;
+
+/**
+ * Parser for the <ws-handler/> element.
+ *
+ * @author Mark Fisher
+ */
+public class WebServiceHandlerParser extends AbstractSingleBeanDefinitionParser {
+
+ @Override
+ protected Class> getBeanClass(Element element) {
+ return (StringUtils.hasText(element.getAttribute("marshaller"))) ?
+ MarshallingWebServiceHandler.class : SimpleWebServiceHandler.class;
+ }
+
+ @Override
+ protected boolean shouldGenerateId() {
+ return false;
+ }
+
+ @Override
+ protected boolean shouldGenerateIdAsFallback() {
+ return true;
+ }
+
+ @Override
+ protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
+ String uri = element.getAttribute("uri");
+ if (!StringUtils.hasText(uri)) {
+ throw new ConfigurationException("The 'uri' attribute is required.");
+ }
+ builder.addConstructorArgValue(uri);
+ String marshallerRef = element.getAttribute("marshaller");
+ if (StringUtils.hasText(marshallerRef)) {
+ builder.addConstructorArgReference(marshallerRef);
+ String unmarshallerRef = element.getAttribute("unmarshaller");
+ if (StringUtils.hasText(unmarshallerRef)) {
+ builder.addConstructorArgReference(unmarshallerRef);
+ }
+ }
+ else {
+ String sourceExtractorRef = element.getAttribute("source-extractor");
+ if (StringUtils.hasText(sourceExtractorRef)) {
+ builder.addConstructorArgReference(sourceExtractorRef);
+ }
+ }
+ }
+
+}
diff --git a/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/config/WebServiceTargetAdapterParser.java b/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/config/WebServiceTargetAdapterParser.java
deleted file mode 100644
index 154f95438c..0000000000
--- a/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/config/WebServiceTargetAdapterParser.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * 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 org.w3c.dom.Element;
-
-import org.springframework.beans.factory.config.RuntimeBeanReference;
-import org.springframework.beans.factory.parsing.BeanComponentDefinition;
-import org.springframework.beans.factory.support.BeanDefinitionBuilder;
-import org.springframework.beans.factory.support.RootBeanDefinition;
-import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
-import org.springframework.beans.factory.xml.ParserContext;
-import org.springframework.integration.ConfigurationException;
-import org.springframework.integration.endpoint.HandlerEndpoint;
-import org.springframework.integration.scheduling.Subscription;
-import org.springframework.integration.ws.adapter.MarshallingWebServiceTargetAdapter;
-import org.springframework.integration.ws.adapter.SimpleWebServiceTargetAdapter;
-import org.springframework.util.StringUtils;
-
-/**
- * Parser for the <ws-target/> element.
- *
- * @author Mark Fisher
- */
-public class WebServiceTargetAdapterParser extends AbstractSingleBeanDefinitionParser {
-
- protected Class> getBeanClass(Element element) {
- return HandlerEndpoint.class;
- }
-
- protected boolean shouldGenerateId() {
- return false;
- }
-
- protected boolean shouldGenerateIdAsFallback() {
- return true;
- }
-
- protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
- String channel = element.getAttribute("channel");
- String uri = element.getAttribute("uri");
- if (!StringUtils.hasText(channel)) {
- throw new ConfigurationException("The 'channel' attribute is required.");
- }
- if (!StringUtils.hasText(uri)) {
- throw new ConfigurationException("The 'uri' attribute is required.");
- }
- String marshallerRef = element.getAttribute("marshaller");
- String unmarshallerRef = element.getAttribute("unmarshaller");
- String sourceExtractorRef = element.getAttribute("source-extractor");
- RootBeanDefinition adapterDef = (StringUtils.hasText(marshallerRef)) ?
- this.parseMarshallingAdapter(uri, marshallerRef, unmarshallerRef) :
- this.parseSimpleAdapter(uri, sourceExtractorRef);
- String adapterBeanName = parserContext.getReaderContext().generateBeanName(adapterDef);
- parserContext.registerBeanComponent(new BeanComponentDefinition(adapterDef, adapterBeanName));
- builder.addConstructorArgReference(adapterBeanName);
- Subscription subscription = new Subscription(channel);
- builder.addPropertyValue("subscription", subscription);
- }
-
- private RootBeanDefinition parseMarshallingAdapter(String uri, String marshallerRef, String unmarshallerRef) {
- RootBeanDefinition beanDefinition = new RootBeanDefinition(MarshallingWebServiceTargetAdapter.class);
- beanDefinition.getConstructorArgumentValues().addGenericArgumentValue(uri);
- beanDefinition.getConstructorArgumentValues().addGenericArgumentValue(new RuntimeBeanReference(marshallerRef));
- if (StringUtils.hasText(unmarshallerRef)) {
- beanDefinition.getConstructorArgumentValues().addGenericArgumentValue(new RuntimeBeanReference(unmarshallerRef));
- }
- return beanDefinition;
- }
-
- private RootBeanDefinition parseSimpleAdapter(String uri, String sourceExtrractorRef) {
- RootBeanDefinition beanDefinition = new RootBeanDefinition(SimpleWebServiceTargetAdapter.class);
- beanDefinition.getConstructorArgumentValues().addGenericArgumentValue(uri);
- if (StringUtils.hasText(sourceExtrractorRef)) {
- beanDefinition.getConstructorArgumentValues().addGenericArgumentValue(new RuntimeBeanReference(sourceExtrractorRef));
- }
- return beanDefinition;
- }
-
-}
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 3f50a8ce18..421e68ce4e 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
@@ -19,16 +19,15 @@
]]>
-
+
- Defines a Web Service target channel adapter.
+ Defines a Web Service MessageHandler adapter.
-
diff --git a/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/adapter/AbstractWebServiceTargetAdapter.java b/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/handler/AbstractWebServiceHandler.java
similarity index 88%
rename from org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/adapter/AbstractWebServiceTargetAdapter.java
rename to org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/handler/AbstractWebServiceHandler.java
index 54980af44c..3330833e82 100644
--- a/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/adapter/AbstractWebServiceTargetAdapter.java
+++ b/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/handler/AbstractWebServiceHandler.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.springframework.integration.ws.adapter;
+package org.springframework.integration.ws.handler;
import java.io.IOException;
import java.net.URI;
@@ -32,11 +32,11 @@ import org.springframework.ws.soap.SoapMessage;
import org.springframework.ws.soap.client.core.SoapActionCallback;
/**
- * Base class for Web Service target channel adapters.
+ * Base class for Web Service {@link MessageHandler} adapters.
*
* @author Mark Fisher
*/
-public abstract class AbstractWebServiceTargetAdapter implements MessageHandler {
+public abstract class AbstractWebServiceHandler implements MessageHandler {
public static final String SOAP_ACTION_PROPERTY_KEY = "_ws.soapAction";
@@ -46,8 +46,8 @@ public abstract class AbstractWebServiceTargetAdapter implements MessageHandler
private volatile WebServiceMessageCallback requestCallback;
- public AbstractWebServiceTargetAdapter(URI uri) {
- Assert.notNull(uri, "'uri' must not be null");
+ public AbstractWebServiceHandler(URI uri) {
+ Assert.notNull(uri, "URI must not be null");
this.webServiceTemplate.setDefaultUri(uri.toString());
}
@@ -70,7 +70,7 @@ public abstract class AbstractWebServiceTargetAdapter implements MessageHandler
public final Message> handle(Message> message) {
Object responsePayload = this.doHandle(message.getPayload(), this.getRequestCallback(message));
- return (responsePayload != null ? new GenericMessage