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 3690219b90..f14fbae72e 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,7 +20,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.integration.channel.MessageChannel; import org.springframework.integration.message.Message; import org.springframework.integration.message.MessageBuilder; -import org.springframework.integration.ws.handler.AbstractWebServiceHandler; +import org.springframework.integration.ws.AbstractWebServiceOutboundGateway; /** * Demonstrating a web service invocation through a Web Service MessageHandler. @@ -41,7 +41,7 @@ public class WebServiceDemo { // Create the Message object // In this case the service expects a SoapAction header Message message = MessageBuilder.withPayload(requestXml) - .setHeader(AbstractWebServiceHandler.SOAP_ACTION_PROPERTY_KEY, "http://tempuri.org/FahrenheitToCelsius") + .setHeader(AbstractWebServiceOutboundGateway.SOAP_ACTION_PROPERTY_KEY, "http://tempuri.org/FahrenheitToCelsius") .build(); // Send the Message to the handler's input channel 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 107d3a8419..4fc3dd1f39 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 @@ -17,12 +17,13 @@ - - + + diff --git a/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/handler/AbstractWebServiceHandler.java b/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/AbstractWebServiceOutboundGateway.java similarity index 86% rename from org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/handler/AbstractWebServiceHandler.java rename to org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/AbstractWebServiceOutboundGateway.java index 62ff4ba401..0173fd28fd 100644 --- a/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/handler/AbstractWebServiceHandler.java +++ b/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/AbstractWebServiceOutboundGateway.java @@ -14,11 +14,12 @@ * limitations under the License. */ -package org.springframework.integration.ws.handler; +package org.springframework.integration.ws; import java.io.IOException; import java.net.URI; +import org.springframework.integration.channel.MessageChannel; import org.springframework.integration.endpoint.AbstractReplyProducingMessageConsumer; import org.springframework.integration.message.GenericMessage; import org.springframework.integration.message.Message; @@ -33,13 +34,13 @@ import org.springframework.ws.soap.client.core.SoapActionCallback; import org.springframework.ws.transport.WebServiceMessageSender; /** - * Base class for outbound Web Service-invoking adapters. + * Base class for outbound Web Service-invoking Messaging Gateways. * * @author Mark Fisher */ -public abstract class AbstractWebServiceHandler extends AbstractReplyProducingMessageConsumer { +public abstract class AbstractWebServiceOutboundGateway extends AbstractReplyProducingMessageConsumer { - public static final String SOAP_ACTION_PROPERTY_KEY = "_ws.soapAction"; + public static final String SOAP_ACTION_PROPERTY_KEY = "spring.integration.ws.soapAction"; private final WebServiceTemplate webServiceTemplate; @@ -47,7 +48,7 @@ public abstract class AbstractWebServiceHandler extends AbstractReplyProducingMe private volatile WebServiceMessageCallback requestCallback; - public AbstractWebServiceHandler(URI uri, WebServiceMessageFactory messageFactory) { + public AbstractWebServiceOutboundGateway(URI uri, WebServiceMessageFactory messageFactory) { Assert.notNull(uri, "URI must not be null"); this.webServiceTemplate = (messageFactory != null) ? new WebServiceTemplate(messageFactory) : new WebServiceTemplate(); @@ -55,6 +56,10 @@ public abstract class AbstractWebServiceHandler extends AbstractReplyProducingMe } + public void setReplyChannel(MessageChannel replyChannel) { + this.setOutputChannel(replyChannel); + } + public void setMessageFactory(WebServiceMessageFactory messageFactory) { this.webServiceTemplate.setMessageFactory(messageFactory); } @@ -66,7 +71,7 @@ public abstract class AbstractWebServiceHandler extends AbstractReplyProducingMe public void setFaultMessageResolver(FaultMessageResolver faultMessageResolver) { this.webServiceTemplate.setFaultMessageResolver(faultMessageResolver); } - + public void setMessageSender(WebServiceMessageSender messageSender) { this.webServiceTemplate.setMessageSender(messageSender); } @@ -74,7 +79,7 @@ public abstract class AbstractWebServiceHandler extends AbstractReplyProducingMe public void setMessageSenders(WebServiceMessageSender[] messageSenders) { this.webServiceTemplate.setMessageSenders(messageSenders); } - + protected WebServiceTemplate getWebServiceTemplate() { return this.webServiceTemplate; } diff --git a/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/handler/MarshallingWebServiceHandler.java b/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/MarshallingWebServiceOutboundGateway.java similarity index 74% rename from org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/handler/MarshallingWebServiceHandler.java rename to org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/MarshallingWebServiceOutboundGateway.java index 7190650655..9a2f3be47c 100644 --- a/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/handler/MarshallingWebServiceHandler.java +++ b/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/MarshallingWebServiceOutboundGateway.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.integration.ws.handler; +package org.springframework.integration.ws; import java.net.URI; @@ -25,15 +25,16 @@ import org.springframework.ws.WebServiceMessageFactory; import org.springframework.ws.client.core.WebServiceMessageCallback; /** - * A marshalling Web Service MessageHandler adapter. + * An outbound Messaging Gateway for invoking Web Services that also supports + * marshalling and unmarshalling of the request and response messages. * * @author Mark Fisher * @see Marshaller * @see Unmarshaller */ -public class MarshallingWebServiceHandler extends AbstractWebServiceHandler { +public class MarshallingWebServiceOutboundGateway extends AbstractWebServiceOutboundGateway { - public MarshallingWebServiceHandler(URI uri, Marshaller marshaller, Unmarshaller unmarshaller, WebServiceMessageFactory messageFactory) { + public MarshallingWebServiceOutboundGateway(URI uri, Marshaller marshaller, Unmarshaller unmarshaller, WebServiceMessageFactory messageFactory) { super(uri, messageFactory); Assert.notNull(marshaller, "marshaller must not be null"); Assert.notNull(unmarshaller, "unmarshaller must not be null"); @@ -41,11 +42,11 @@ public class MarshallingWebServiceHandler extends AbstractWebServiceHandler { this.getWebServiceTemplate().setUnmarshaller(unmarshaller); } - public MarshallingWebServiceHandler(URI uri, Marshaller marshaller, Unmarshaller unmarshaller) { + public MarshallingWebServiceOutboundGateway(URI uri, Marshaller marshaller, Unmarshaller unmarshaller) { this(uri, marshaller, unmarshaller, null); } - public MarshallingWebServiceHandler(URI uri, Marshaller marshaller, WebServiceMessageFactory messageFactory) { + public MarshallingWebServiceOutboundGateway(URI uri, Marshaller marshaller, WebServiceMessageFactory messageFactory) { super(uri, messageFactory); Assert.notNull(marshaller, "marshaller must not be null"); Assert.isInstanceOf(Unmarshaller.class, marshaller, @@ -56,7 +57,7 @@ public class MarshallingWebServiceHandler extends AbstractWebServiceHandler { this.getWebServiceTemplate().setUnmarshaller((Unmarshaller) marshaller); } - public MarshallingWebServiceHandler(URI uri, Marshaller marshaller) { + public MarshallingWebServiceOutboundGateway(URI uri, Marshaller marshaller) { this(uri, marshaller, (WebServiceMessageFactory) null); } diff --git a/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/handler/SimpleWebServiceHandler.java b/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/SimpleWebServiceOutboundGateway.java similarity index 80% rename from org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/handler/SimpleWebServiceHandler.java rename to org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/SimpleWebServiceOutboundGateway.java index f8e6fdbdbd..6eb24c9926 100644 --- a/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/handler/SimpleWebServiceHandler.java +++ b/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/SimpleWebServiceOutboundGateway.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.integration.ws.handler; +package org.springframework.integration.ws; import java.io.IOException; import java.net.URI; @@ -24,6 +24,8 @@ import javax.xml.transform.TransformerException; import javax.xml.transform.dom.DOMResult; import javax.xml.transform.dom.DOMSource; +import org.w3c.dom.Document; + import org.springframework.integration.message.MessagingException; import org.springframework.ws.WebServiceMessageFactory; import org.springframework.ws.client.core.SourceExtractor; @@ -31,27 +33,26 @@ import org.springframework.ws.client.core.WebServiceMessageCallback; import org.springframework.xml.transform.StringResult; import org.springframework.xml.transform.StringSource; import org.springframework.xml.transform.TransformerObjectSupport; -import org.w3c.dom.Document; /** - * A MessageHandler adapter for invoking a Web Service. + * An outbound Messaging Gateway for invoking a Web Service. * * @author Mark Fisher */ -public class SimpleWebServiceHandler extends AbstractWebServiceHandler { +public class SimpleWebServiceOutboundGateway extends AbstractWebServiceOutboundGateway { private final SourceExtractor sourceExtractor; - public SimpleWebServiceHandler(URI uri) { + public SimpleWebServiceOutboundGateway(URI uri) { this(uri, null, null); } - public SimpleWebServiceHandler(URI uri, SourceExtractor sourceExtractor) { + public SimpleWebServiceOutboundGateway(URI uri, SourceExtractor sourceExtractor) { this(uri, sourceExtractor, (WebServiceMessageFactory) null); } - public SimpleWebServiceHandler(URI uri, SourceExtractor sourceExtractor, WebServiceMessageFactory messageFactory) { + public SimpleWebServiceOutboundGateway(URI uri, SourceExtractor sourceExtractor, WebServiceMessageFactory messageFactory) { super(uri, messageFactory); this.sourceExtractor = (sourceExtractor != null) ? sourceExtractor : new DefaultSourceExtractor(); } @@ -69,16 +70,16 @@ public class SimpleWebServiceHandler extends AbstractWebServiceHandler { new StringSource((String) requestPayload), requestCallback, result); return result.toString(); } - if(requestPayload instanceof Document){ + if (requestPayload instanceof Document) { DOMResult result = new DOMResult(); this.getWebServiceTemplate().sendSourceAndReceiveToResult( new DOMSource((Document) requestPayload), requestCallback, result); return (Document)result.getNode(); - } throw new MessagingException("Unsupported payload type '" + requestPayload.getClass() + - "'. " + this.getClass().getName() + " only supports 'java.lang.String' and '" + Source.class.getName() + - "'. Consider using the '" + MarshallingWebServiceHandler.class.getName() + "' instead."); + "'. " + this.getClass().getName() + " only supports 'java.lang.String', '" + Source.class.getName() + + "', and '" + Document.class.getName() + "'. Consider either using the '" + + MarshallingWebServiceOutboundGateway.class.getName() + "' or a Message Transformer."); } 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/WebServiceOutboundGatewayParser.java similarity index 87% rename from org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/config/WebServiceHandlerParser.java rename to org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/config/WebServiceOutboundGatewayParser.java index 95c882541d..a821608ddf 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/WebServiceOutboundGatewayParser.java @@ -20,27 +20,22 @@ import org.w3c.dom.Element; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.integration.adapter.config.AbstractRemotingOutboundGatewayParser; -import org.springframework.integration.ws.handler.MarshallingWebServiceHandler; -import org.springframework.integration.ws.handler.SimpleWebServiceHandler; +import org.springframework.integration.ws.MarshallingWebServiceOutboundGateway; +import org.springframework.integration.ws.SimpleWebServiceOutboundGateway; import org.springframework.util.Assert; import org.springframework.util.StringUtils; /** - * Parser for the <ws-handler/> element. + * Parser for the <outbound-gateway/> element in the 'ws' namespace. * * @author Mark Fisher */ -public class WebServiceHandlerParser extends AbstractRemotingOutboundGatewayParser { +public class WebServiceOutboundGatewayParser extends AbstractRemotingOutboundGatewayParser { @Override protected Class getGatewayClass(Element element) { return (StringUtils.hasText(element.getAttribute("marshaller"))) ? - MarshallingWebServiceHandler.class : SimpleWebServiceHandler.class; - } - - @Override - protected String getInputChannelAttributeName() { - return "input-channel"; + MarshallingWebServiceOutboundGateway.class : SimpleWebServiceOutboundGateway.class; } @Override diff --git a/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/config/WsNamespaceHandler.java b/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/config/WsNamespaceHandler.java index 667c628037..be0724b1b8 100644 --- a/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/config/WsNamespaceHandler.java +++ b/org.springframework.integration.ws/src/main/java/org/springframework/integration/ws/config/WsNamespaceHandler.java @@ -24,7 +24,7 @@ import org.springframework.beans.factory.xml.NamespaceHandlerSupport; public class WsNamespaceHandler extends NamespaceHandlerSupport { public void init() { - this.registerBeanDefinitionParser("service-activator", new WebServiceHandlerParser()); + this.registerBeanDefinitionParser("outbound-gateway", new WebServiceOutboundGatewayParser()); } } 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 47bc601db8..74f8ff620d 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 @@ -18,19 +18,19 @@ ]]> - + - Defines a Web Service based Service Activator endpoint. + Defines a Web Service based outbound Messaging Gateway. - + - - + + 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/WebServiceOutboundGatewayParserTests.java similarity index 73% rename from org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/WebServiceHandlerParserTests.java rename to org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/WebServiceOutboundGatewayParserTests.java index 829867a65b..fb205458b0 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/WebServiceOutboundGatewayParserTests.java @@ -27,8 +27,8 @@ import org.springframework.integration.endpoint.MessageEndpoint; import org.springframework.integration.endpoint.PollingConsumerEndpoint; import org.springframework.integration.endpoint.SubscribingConsumerEndpoint; import org.springframework.integration.scheduling.IntervalTrigger; -import org.springframework.integration.ws.handler.MarshallingWebServiceHandler; -import org.springframework.integration.ws.handler.SimpleWebServiceHandler; +import org.springframework.integration.ws.MarshallingWebServiceOutboundGateway; +import org.springframework.integration.ws.SimpleWebServiceOutboundGateway; import org.springframework.oxm.Marshaller; import org.springframework.oxm.Unmarshaller; import org.springframework.ws.WebServiceMessageFactory; @@ -40,54 +40,54 @@ import org.springframework.ws.transport.WebServiceMessageSender; /** * @author Mark Fisher */ -public class WebServiceHandlerParserTests { +public class WebServiceOutboundGatewayParserTests { @Test - public void testSimpleWebServiceHandlerWithDefaultSourceExtractor() { + public void simpleGatewayWithDefaultSourceExtractor() { ApplicationContext context = new ClassPathXmlApplicationContext( - "simpleWebServiceHandlerParserTests.xml", this.getClass()); - MessageEndpoint endpoint = (MessageEndpoint) context.getBean("handlerWithDefaultSourceExtractor"); + "simpleWebServiceOutboundGatewayParserTests.xml", this.getClass()); + MessageEndpoint endpoint = (MessageEndpoint) context.getBean("gatewayWithDefaultSourceExtractor"); assertEquals(SubscribingConsumerEndpoint.class, endpoint.getClass()); Object gateway = new DirectFieldAccessor(endpoint).getPropertyValue("consumer"); - assertEquals(SimpleWebServiceHandler.class, gateway.getClass()); + assertEquals(SimpleWebServiceOutboundGateway.class, gateway.getClass()); DirectFieldAccessor accessor = new DirectFieldAccessor(gateway); assertEquals("DefaultSourceExtractor", accessor.getPropertyValue("sourceExtractor").getClass().getSimpleName()); } @Test - public void testSimpleWebServiceHandlerWithCustomSourceExtractor() { + public void simpleGatewayWithCustomSourceExtractor() { ApplicationContext context = new ClassPathXmlApplicationContext( - "simpleWebServiceHandlerParserTests.xml", this.getClass()); - MessageEndpoint endpoint = (MessageEndpoint) context.getBean("handlerWithCustomSourceExtractor"); + "simpleWebServiceOutboundGatewayParserTests.xml", this.getClass()); + MessageEndpoint endpoint = (MessageEndpoint) context.getBean("gatewayWithCustomSourceExtractor"); assertEquals(SubscribingConsumerEndpoint.class, endpoint.getClass()); Object gateway = new DirectFieldAccessor(endpoint).getPropertyValue("consumer"); - assertEquals(SimpleWebServiceHandler.class, gateway.getClass()); + assertEquals(SimpleWebServiceOutboundGateway.class, gateway.getClass()); DirectFieldAccessor accessor = new DirectFieldAccessor(gateway); SourceExtractor sourceExtractor = (SourceExtractor) context.getBean("sourceExtractor"); assertEquals(sourceExtractor, accessor.getPropertyValue("sourceExtractor")); } @Test - public void testSimpleWebServiceHandlerWithCustomRequestCallback() { + public void simpleGatewayWithCustomRequestCallback() { ApplicationContext context = new ClassPathXmlApplicationContext( - "simpleWebServiceHandlerParserTests.xml", this.getClass()); - MessageEndpoint endpoint = (MessageEndpoint) context.getBean("handlerWithCustomRequestCallback"); + "simpleWebServiceOutboundGatewayParserTests.xml", this.getClass()); + MessageEndpoint endpoint = (MessageEndpoint) context.getBean("gatewayWithCustomRequestCallback"); assertEquals(SubscribingConsumerEndpoint.class, endpoint.getClass()); Object gateway = new DirectFieldAccessor(endpoint).getPropertyValue("consumer"); - assertEquals(SimpleWebServiceHandler.class, gateway.getClass()); + assertEquals(SimpleWebServiceOutboundGateway.class, gateway.getClass()); DirectFieldAccessor accessor = new DirectFieldAccessor(gateway); WebServiceMessageCallback callback = (WebServiceMessageCallback) context.getBean("requestCallback"); assertEquals(callback, accessor.getPropertyValue("requestCallback")); } @Test - public void testSimpleWebServiceHandlerWithCustomMessageFactory() { + public void simpleGatewayWithCustomMessageFactory() { ApplicationContext context = new ClassPathXmlApplicationContext( - "simpleWebServiceHandlerParserTests.xml", this.getClass()); - MessageEndpoint endpoint = (MessageEndpoint) context.getBean("handlerWithCustomMessageFactory"); + "simpleWebServiceOutboundGatewayParserTests.xml", this.getClass()); + MessageEndpoint endpoint = (MessageEndpoint) context.getBean("gatewayWithCustomMessageFactory"); assertEquals(SubscribingConsumerEndpoint.class, endpoint.getClass()); Object gateway = new DirectFieldAccessor(endpoint).getPropertyValue("consumer"); - assertEquals(SimpleWebServiceHandler.class, gateway.getClass()); + assertEquals(SimpleWebServiceOutboundGateway.class, gateway.getClass()); DirectFieldAccessor accessor = new DirectFieldAccessor(gateway); accessor = new DirectFieldAccessor(accessor.getPropertyValue("webServiceTemplate")); WebServiceMessageFactory factory = (WebServiceMessageFactory) context.getBean("messageFactory"); @@ -95,14 +95,14 @@ public class WebServiceHandlerParserTests { } @Test - public void testSimpleWebServiceHandlerWithCustomSourceExtractorAndMessageFactory() { + public void simpleGatewayWithCustomSourceExtractorAndMessageFactory() { ApplicationContext context = new ClassPathXmlApplicationContext( - "simpleWebServiceHandlerParserTests.xml", this.getClass()); - MessageEndpoint endpoint = (MessageEndpoint) context.getBean("handlerWithCustomSourceExtractorAndMessageFactory"); + "simpleWebServiceOutboundGatewayParserTests.xml", this.getClass()); + MessageEndpoint endpoint = (MessageEndpoint) context.getBean("gatewayWithCustomSourceExtractorAndMessageFactory"); SourceExtractor sourceExtractor = (SourceExtractor) context.getBean("sourceExtractor"); assertEquals(SubscribingConsumerEndpoint.class, endpoint.getClass()); Object gateway = new DirectFieldAccessor(endpoint).getPropertyValue("consumer"); - assertEquals(SimpleWebServiceHandler.class, gateway.getClass()); + assertEquals(SimpleWebServiceOutboundGateway.class, gateway.getClass()); DirectFieldAccessor accessor = new DirectFieldAccessor(gateway); assertEquals(sourceExtractor, accessor.getPropertyValue("sourceExtractor")); accessor = new DirectFieldAccessor(accessor.getPropertyValue("webServiceTemplate")); @@ -111,13 +111,13 @@ public class WebServiceHandlerParserTests { } @Test - public void testSimpleWebServiceHandlerWithCustomFaultMessageResolver() { + public void simpleGatewayWithCustomFaultMessageResolver() { ApplicationContext context = new ClassPathXmlApplicationContext( - "simpleWebServiceHandlerParserTests.xml", this.getClass()); - MessageEndpoint endpoint = (MessageEndpoint) context.getBean("handlerWithCustomFaultMessageResolver"); + "simpleWebServiceOutboundGatewayParserTests.xml", this.getClass()); + MessageEndpoint endpoint = (MessageEndpoint) context.getBean("gatewayWithCustomFaultMessageResolver"); assertEquals(SubscribingConsumerEndpoint.class, endpoint.getClass()); Object gateway = new DirectFieldAccessor(endpoint).getPropertyValue("consumer"); - assertEquals(SimpleWebServiceHandler.class, gateway.getClass()); + assertEquals(SimpleWebServiceOutboundGateway.class, gateway.getClass()); DirectFieldAccessor accessor = new DirectFieldAccessor(gateway); accessor = new DirectFieldAccessor(accessor.getPropertyValue("webServiceTemplate")); FaultMessageResolver resolver = (FaultMessageResolver) context.getBean("faultMessageResolver"); @@ -126,58 +126,57 @@ public class WebServiceHandlerParserTests { @Test - public void testSimpleWebServiceHandlerWithCustomMessageSender() { + public void simpleGatewayWithCustomMessageSender() { ApplicationContext context = new ClassPathXmlApplicationContext( - "simpleWebServiceHandlerParserTests.xml", this.getClass()); - MessageEndpoint endpoint = (MessageEndpoint) context.getBean("handlerWithCustomMessageSender"); + "simpleWebServiceOutboundGatewayParserTests.xml", this.getClass()); + MessageEndpoint endpoint = (MessageEndpoint) context.getBean("gatewayWithCustomMessageSender"); assertEquals(SubscribingConsumerEndpoint.class, endpoint.getClass()); Object gateway = new DirectFieldAccessor(endpoint).getPropertyValue("consumer"); - assertEquals(SimpleWebServiceHandler.class, gateway.getClass()); + assertEquals(SimpleWebServiceOutboundGateway.class, gateway.getClass()); DirectFieldAccessor accessor = new DirectFieldAccessor(gateway); accessor = new DirectFieldAccessor(accessor.getPropertyValue("webServiceTemplate")); WebServiceMessageSender messageSender = (WebServiceMessageSender) context.getBean("messageSender"); assertEquals(messageSender, ((WebServiceMessageSender[])accessor.getPropertyValue("messageSenders"))[0]); } @Test - public void testSimpleWebServiceHandlerWithCustomMessageSenderList() { + public void simpleGatewayWithCustomMessageSenderList() { ApplicationContext context = new ClassPathXmlApplicationContext( - "simpleWebServiceHandlerParserTests.xml", this.getClass()); - MessageEndpoint endpoint = (MessageEndpoint) context.getBean("handlerWithCustomMessageSenderList"); + "simpleWebServiceOutboundGatewayParserTests.xml", this.getClass()); + MessageEndpoint endpoint = (MessageEndpoint) context.getBean("gatewayWithCustomMessageSenderList"); assertEquals(SubscribingConsumerEndpoint.class, endpoint.getClass()); Object gateway = new DirectFieldAccessor(endpoint).getPropertyValue("consumer"); - assertEquals(SimpleWebServiceHandler.class, gateway.getClass()); + assertEquals(SimpleWebServiceOutboundGateway.class, gateway.getClass()); DirectFieldAccessor accessor = new DirectFieldAccessor(gateway); accessor = new DirectFieldAccessor(accessor.getPropertyValue("webServiceTemplate")); WebServiceMessageSender messageSender = (WebServiceMessageSender) context.getBean("messageSender"); assertEquals(messageSender, ((WebServiceMessageSender[])accessor.getPropertyValue("messageSenders"))[0]); - assertEquals("Wrong number of message senders " ,2 , ((WebServiceMessageSender[])accessor.getPropertyValue("messageSenders")).length); - } - - - @Test - public void testSimpleWebServiceHandlerWithPoller() { - ApplicationContext context = new ClassPathXmlApplicationContext( - "simpleWebServiceHandlerParserTests.xml", this.getClass()); - MessageEndpoint endpoint = (MessageEndpoint) context.getBean("handlerWithPoller"); - assertEquals(PollingConsumerEndpoint.class, endpoint.getClass()); - Object obj = new DirectFieldAccessor(endpoint).getPropertyValue("trigger"); - assertEquals(IntervalTrigger.class, obj.getClass()); - - IntervalTrigger trigger = (IntervalTrigger)obj; - DirectFieldAccessor accessor = new DirectFieldAccessor(trigger); - accessor = new DirectFieldAccessor(trigger); - - assertEquals("IntervalTrigger had wrong itnerval" , 5000, ((Long)accessor.getPropertyValue("interval")).longValue()); + assertEquals("Wrong number of message senders ", + 2 , ((WebServiceMessageSender[])accessor.getPropertyValue("messageSenders")).length); } @Test - public void testWebServiceHandlerWithAllInOneMarshaller() { + public void simpleGatewayWithPoller() { ApplicationContext context = new ClassPathXmlApplicationContext( - "marshallingWebServiceHandlerParserTests.xml", this.getClass()); - MessageEndpoint endpoint = (MessageEndpoint) context.getBean("handlerWithAllInOneMarshaller"); + "simpleWebServiceOutboundGatewayParserTests.xml", this.getClass()); + MessageEndpoint endpoint = (MessageEndpoint) context.getBean("gatewayWithPoller"); + assertEquals(PollingConsumerEndpoint.class, endpoint.getClass()); + Object obj = new DirectFieldAccessor(endpoint).getPropertyValue("trigger"); + assertEquals(IntervalTrigger.class, obj.getClass()); + IntervalTrigger trigger = (IntervalTrigger) obj; + DirectFieldAccessor accessor = new DirectFieldAccessor(trigger); + accessor = new DirectFieldAccessor(trigger); + assertEquals("IntervalTrigger had wrong interval", + 5000, ((Long)accessor.getPropertyValue("interval")).longValue()); + } + + @Test + public void marshallingGatewayWithAllInOneMarshaller() { + ApplicationContext context = new ClassPathXmlApplicationContext( + "marshallingWebServiceOutboundGatewayParserTests.xml", this.getClass()); + MessageEndpoint endpoint = (MessageEndpoint) context.getBean("gatewayWithAllInOneMarshaller"); assertEquals(SubscribingConsumerEndpoint.class, endpoint.getClass()); Object gateway = new DirectFieldAccessor(endpoint).getPropertyValue("consumer"); - assertEquals(MarshallingWebServiceHandler.class, gateway.getClass()); + assertEquals(MarshallingWebServiceOutboundGateway.class, gateway.getClass()); DirectFieldAccessor gatewayAccessor = new DirectFieldAccessor(gateway); DirectFieldAccessor templateAccessor = new DirectFieldAccessor( gatewayAccessor.getPropertyValue("webServiceTemplate")); @@ -187,13 +186,13 @@ public class WebServiceHandlerParserTests { } @Test - public void testWebServiceHandlerWithSeparateMarshallerAndUnmarshaller() { + public void marshallingGatewayWithSeparateMarshallerAndUnmarshaller() { ApplicationContext context = new ClassPathXmlApplicationContext( - "marshallingWebServiceHandlerParserTests.xml", this.getClass()); - MessageEndpoint endpoint = (MessageEndpoint) context.getBean("handlerWithSeparateMarshallerAndUnmarshaller"); + "marshallingWebServiceOutboundGatewayParserTests.xml", this.getClass()); + MessageEndpoint endpoint = (MessageEndpoint) context.getBean("gatewayWithSeparateMarshallerAndUnmarshaller"); assertEquals(SubscribingConsumerEndpoint.class, endpoint.getClass()); Object gateway = new DirectFieldAccessor(endpoint).getPropertyValue("consumer"); - assertEquals(MarshallingWebServiceHandler.class, gateway.getClass()); + assertEquals(MarshallingWebServiceOutboundGateway.class, gateway.getClass()); DirectFieldAccessor gatewayAccessor = new DirectFieldAccessor(gateway); DirectFieldAccessor templateAccessor = new DirectFieldAccessor( gatewayAccessor.getPropertyValue("webServiceTemplate")); @@ -204,26 +203,26 @@ public class WebServiceHandlerParserTests { } @Test - public void testMarshallingWebServiceHandlerWithCustomRequestCallback() { + public void marshallingGatewayWithCustomRequestCallback() { ApplicationContext context = new ClassPathXmlApplicationContext( - "marshallingWebServiceHandlerParserTests.xml", this.getClass()); - MessageEndpoint endpoint = (MessageEndpoint) context.getBean("handlerWithCustomRequestCallback"); + "marshallingWebServiceOutboundGatewayParserTests.xml", this.getClass()); + MessageEndpoint endpoint = (MessageEndpoint) context.getBean("gatewayWithCustomRequestCallback"); assertEquals(SubscribingConsumerEndpoint.class, endpoint.getClass()); Object gateway = new DirectFieldAccessor(endpoint).getPropertyValue("consumer"); - assertEquals(MarshallingWebServiceHandler.class, gateway.getClass()); + assertEquals(MarshallingWebServiceOutboundGateway.class, gateway.getClass()); DirectFieldAccessor accessor = new DirectFieldAccessor(gateway); WebServiceMessageCallback callback = (WebServiceMessageCallback) context.getBean("requestCallback"); assertEquals(callback, accessor.getPropertyValue("requestCallback")); } @Test - public void testWebServiceHandlerWithAllInOneMarshallerAndMessageFactory() { + public void marshallingGatewayWithAllInOneMarshallerAndMessageFactory() { ApplicationContext context = new ClassPathXmlApplicationContext( - "marshallingWebServiceHandlerParserTests.xml", this.getClass()); - MessageEndpoint endpoint = (MessageEndpoint) context.getBean("handlerWithAllInOneMarshallerAndMessageFactory"); + "marshallingWebServiceOutboundGatewayParserTests.xml", this.getClass()); + MessageEndpoint endpoint = (MessageEndpoint) context.getBean("gatewayWithAllInOneMarshallerAndMessageFactory"); assertEquals(SubscribingConsumerEndpoint.class, endpoint.getClass()); Object gateway = new DirectFieldAccessor(endpoint).getPropertyValue("consumer"); - assertEquals(MarshallingWebServiceHandler.class, gateway.getClass()); + assertEquals(MarshallingWebServiceOutboundGateway.class, gateway.getClass()); DirectFieldAccessor gatewayAccessor = new DirectFieldAccessor(gateway); DirectFieldAccessor templateAccessor = new DirectFieldAccessor( gatewayAccessor.getPropertyValue("webServiceTemplate")); @@ -235,13 +234,13 @@ public class WebServiceHandlerParserTests { } @Test - public void testWebServiceHandlerWithSeparateMarshallerAndUnmarshallerAndMessageFactory() { + public void marshallingGatewayWithSeparateMarshallerAndUnmarshallerAndMessageFactory() { ApplicationContext context = new ClassPathXmlApplicationContext( - "marshallingWebServiceHandlerParserTests.xml", this.getClass()); - MessageEndpoint endpoint = (MessageEndpoint) context.getBean("handlerWithSeparateMarshallerAndUnmarshallerAndMessageFactory"); + "marshallingWebServiceOutboundGatewayParserTests.xml", this.getClass()); + MessageEndpoint endpoint = (MessageEndpoint) context.getBean("gatewayWithSeparateMarshallerAndUnmarshallerAndMessageFactory"); assertEquals(SubscribingConsumerEndpoint.class, endpoint.getClass()); Object gateway = new DirectFieldAccessor(endpoint).getPropertyValue("consumer"); - assertEquals(MarshallingWebServiceHandler.class, gateway.getClass()); + assertEquals(MarshallingWebServiceOutboundGateway.class, gateway.getClass()); DirectFieldAccessor gatewayAccessor = new DirectFieldAccessor(gateway); DirectFieldAccessor templateAccessor = new DirectFieldAccessor( gatewayAccessor.getPropertyValue("webServiceTemplate")); 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 deleted file mode 100644 index cf02454815..0000000000 --- a/org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/marshallingWebServiceHandlerParserTests.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/marshallingWebServiceOutboundGatewayParserTests.xml b/org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/marshallingWebServiceOutboundGatewayParserTests.xml new file mode 100644 index 0000000000..9c3ee14a1b --- /dev/null +++ b/org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/marshallingWebServiceOutboundGatewayParserTests.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + 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 deleted file mode 100644 index b8a569d505..0000000000 --- a/org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/simpleWebServiceHandlerParserTests.xml +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/simpleWebServiceOutboundGatewayParserTests.xml b/org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/simpleWebServiceOutboundGatewayParserTests.xml new file mode 100644 index 0000000000..1ae576e692 --- /dev/null +++ b/org.springframework.integration.ws/src/test/java/org/springframework/integration/ws/config/simpleWebServiceOutboundGatewayParserTests.xml @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +