I am using Spring Integration along with JAXB and Spring-WS to make a pretty straightforward synchronous web service call, and I have written a TestNG test to see if my efforts have worked. My logging is showing that the messages have the expected payloads throughout the chain and that the right answers are being returned by the web service. However, at the end I am getting an exception: "MessageDeliveryException: Dispatcher has no subscribers."
Here is the test code:
Here is the relevant portion of the configuration:Code:ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml"); ChannelResolver channelResolver = new BeanFactoryChannelResolver(context); MessageChannel requestChannel = channelResolver.resolveChannelName("clientAuthenticationRequestChannel"); MessageChannel replyChannel = channelResolver.resolveChannelName("clientAuthenticationResponseChannel"); Credentials credentials = new Credentials("foo", "bar"); SimpleMessagingGateway gateway = new SimpleMessagingGateway(); gateway.setRequestChannel(requestChannel); gateway.setReplyChannel(replyChannel); Object obj = gateway.sendAndReceive(credentials);
Finally, here is the full exception:Code:<chain id="authenticationChain" input-channel="clientAuthenticationRequestChannel" output-channel="clientAuthenticationResponseChannel"> <transformer id="requestTransformer" ref="authenticationRequestTransformerBean" method="transform"/> <ws:outbound-gateway id="authenticationWebServiceGateway" uri="http://myapp.com:9101/axis/services/WSv1" marshaller="marshaller" unmarshaller="marshaller" message-factory="messageFactory"/> <transformer id="responseTransformer" ref="authenticationResponseTransformerBean" method="transform"/> </chain>
I should point out also that for kicks I tried adding an outbound-channel-adapter that takes the clientAuthenticationResponseChannel as an input channel. When I do that, I get no exception, but the test just hangs.Code:org.springframework.integration.message.MessageDeliveryException: Dispatcher has no subscribers. at org.springframework.integration.dispatcher.SimpleDispatcher.dispatch(SimpleDispatcher.java:39) at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:56) at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:116) at org.springframework.integration.channel.MessageChannelTemplate.doSend(MessageChannelTemplate.java:221) at org.springframework.integration.channel.MessageChannelTemplate.send(MessageChannelTemplate.java:179) at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.sendReplyMessage(AbstractReplyProducingMessageHandler.java:115) at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:105) at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:48) at org.springframework.integration.dispatcher.AbstractDispatcher.sendMessageToHandler(AbstractDispatcher.java:75) at org.springframework.integration.dispatcher.SimpleDispatcher.dispatch(SimpleDispatcher.java:45) at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:56) at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:116) at org.springframework.integration.channel.MessageChannelTemplate.doSend(MessageChannelTemplate.java:221) at org.springframework.integration.channel.MessageChannelTemplate.send(MessageChannelTemplate.java:179) at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.sendReplyMessage(AbstractReplyProducingMessageHandler.java:115) at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:105) at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:48) at org.springframework.integration.dispatcher.AbstractDispatcher.sendMessageToHandler(AbstractDispatcher.java:75) at org.springframework.integration.dispatcher.SimpleDispatcher.dispatch(SimpleDispatcher.java:45) at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:56) at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:116) at org.springframework.integration.channel.MessageChannelTemplate.doSend(MessageChannelTemplate.java:221) at org.springframework.integration.channel.MessageChannelTemplate.send(MessageChannelTemplate.java:179) at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.sendReplyMessage(AbstractReplyProducingMessageHandler.java:115) at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:105) at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:48) at org.springframework.integration.handler.MessageHandlerChain.handleMessage(MessageHandlerChain.java:69) at org.springframework.integration.dispatcher.AbstractDispatcher.sendMessageToHandler(AbstractDispatcher.java:75) at org.springframework.integration.dispatcher.SimpleDispatcher.dispatch(SimpleDispatcher.java:45) at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:56) at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:116) at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:94) at org.springframework.integration.channel.MessageChannelTemplate.doSend(MessageChannelTemplate.java:222) at org.springframework.integration.channel.MessageChannelTemplate.send(MessageChannelTemplate.java:179) at org.springframework.integration.gateway.AbstractMessagingGateway.send(AbstractMessagingGateway.java:114) at com.myapp.integration.authentication.test.AuthenticationTest.testSuccessfulAuthentication(AuthenticationTest.java:53)
I would love some insight into why my test is failing and what I need to change so that the SimpleMessagingGateway can receive the output from the web service.
Thanks, and Happy Holidays.


Reply With Quote