From 27c8d31889f8c91e5e8a591db829ae16d448cd21 Mon Sep 17 00:00:00 2001 From: Oleg Zhurakousky Date: Mon, 10 Jan 2011 16:36:05 -0500 Subject: [PATCH] INT-1729 added error-channel suport for WS inbound-gateway --- .../ws/MarshallingWebServiceInboundGateway.java | 5 +++++ .../ws/config/spring-integration-ws-2.0.xsd | 13 +++++++++++++ ...ebServiceInboundGatewayParserTests-context.xml | 6 ++++-- .../WebServiceInboundGatewayParserTests.java | 15 +++++++++++++++ 4 files changed, 37 insertions(+), 2 deletions(-) diff --git a/spring-integration-ws/src/main/java/org/springframework/integration/ws/MarshallingWebServiceInboundGateway.java b/spring-integration-ws/src/main/java/org/springframework/integration/ws/MarshallingWebServiceInboundGateway.java index b058662872..10603fc442 100644 --- a/spring-integration-ws/src/main/java/org/springframework/integration/ws/MarshallingWebServiceInboundGateway.java +++ b/spring-integration-ws/src/main/java/org/springframework/integration/ws/MarshallingWebServiceInboundGateway.java @@ -35,6 +35,7 @@ import org.springframework.ws.server.endpoint.AbstractMarshallingPayloadEndpoint /** * @author Mark Fisher + * @author Oleg Zhurakousky * @since 1.0.2 */ public class MarshallingWebServiceInboundGateway extends AbstractMarshallingPayloadEndpoint @@ -85,6 +86,10 @@ public class MarshallingWebServiceInboundGateway extends AbstractMarshallingPayl public void setRequestTimeout(long requestTimeout) { this.gatewayDelegate.setRequestTimeout(requestTimeout); } + + public void setErrorChannel(MessageChannel errorChannel) { + this.gatewayDelegate.setErrorChannel(errorChannel); + } public void setReplyChannel(MessageChannel replyChannel) { this.gatewayDelegate.setReplyChannel(replyChannel); diff --git a/spring-integration-ws/src/main/resources/org/springframework/integration/ws/config/spring-integration-ws-2.0.xsd b/spring-integration-ws/src/main/resources/org/springframework/integration/ws/config/spring-integration-ws-2.0.xsd index 51338510df..0ce610c4b8 100644 --- a/spring-integration-ws/src/main/resources/org/springframework/integration/ws/config/spring-integration-ws-2.0.xsd +++ b/spring-integration-ws/src/main/resources/org/springframework/integration/ws/config/spring-integration-ws-2.0.xsd @@ -229,6 +229,19 @@ + + + + + + + + + If a (synchronous) downstream exception is thrown and an error-channel is specified, + the MessagingException will be sent to this channel. + + + diff --git a/spring-integration-ws/src/test/java/org/springframework/integration/ws/config/WebServiceInboundGatewayParserTests-context.xml b/spring-integration-ws/src/test/java/org/springframework/integration/ws/config/WebServiceInboundGatewayParserTests-context.xml index a8f01e2a78..02f4b53f71 100644 --- a/spring-integration-ws/src/test/java/org/springframework/integration/ws/config/WebServiceInboundGatewayParserTests-context.xml +++ b/spring-integration-ws/src/test/java/org/springframework/integration/ws/config/WebServiceInboundGatewayParserTests-context.xml @@ -14,13 +14,15 @@ - + + + - diff --git a/spring-integration-ws/src/test/java/org/springframework/integration/ws/config/WebServiceInboundGatewayParserTests.java b/spring-integration-ws/src/test/java/org/springframework/integration/ws/config/WebServiceInboundGatewayParserTests.java index 5756a00a70..ee51dd554c 100644 --- a/spring-integration-ws/src/test/java/org/springframework/integration/ws/config/WebServiceInboundGatewayParserTests.java +++ b/spring-integration-ws/src/test/java/org/springframework/integration/ws/config/WebServiceInboundGatewayParserTests.java @@ -41,6 +41,7 @@ import org.springframework.integration.Message; import org.springframework.integration.MessageChannel; import org.springframework.integration.MessageHeaders; import org.springframework.integration.core.PollableChannel; +import org.springframework.integration.gateway.MessagingGatewaySupport; import org.springframework.integration.history.MessageHistory; import org.springframework.integration.mapping.HeaderMapper; import org.springframework.integration.test.util.TestUtils; @@ -71,6 +72,10 @@ public class WebServiceInboundGatewayParserTests { @Qualifier("requestsSimple") PollableChannel requestsSimple; + @Autowired + @Qualifier("customErrorChannel") + MessageChannel customErrorChannel; + @Autowired @Qualifier("requestsVerySimple") MessageChannel requestsVerySimple; @@ -91,6 +96,10 @@ public class WebServiceInboundGatewayParserTests { assertThat( (MessageChannel) accessor.getPropertyValue("requestChannel"), is(requestsVerySimple)); + + assertThat( + (MessageChannel) accessor.getPropertyValue("errorChannel"), + is(customErrorChannel)); } //extractPayload = false @@ -121,6 +130,12 @@ public class WebServiceInboundGatewayParserTests { assertThat((AbstractMarshaller) accessor.getPropertyValue("unmarshaller"), is(marshaller)); assertTrue("messaging gateway is not running", marshallingGateway.isRunning()); + + MessagingGatewaySupport mgs = (MessagingGatewaySupport) accessor.getPropertyValue("gatewayDelegate"); + DirectFieldAccessor mgsAccessor = new DirectFieldAccessor(mgs); + assertThat( + (MessageChannel) mgsAccessor.getPropertyValue("errorChannel"), + is(customErrorChannel)); } @Test