【问题标题】:org.springframework.integration.MessageDeliveryException: Dispatcher has no subscribersorg.springframework.integration.MessageDeliveryException:调度程序没有订阅者
【发布时间】:2014-12-12 06:17:20
【问题描述】:

我是soap 和spring 集成的新手,我正在尝试使用spring-integration 调用soap 服务,但我收到异常消息“Dispatcher 没有订阅者”。我在下面粘贴了我的代码。请帮我看看哪里出错了。

soapcall-config.xml

<int:gateway id="ws" service-interface="com.sa.WsGateway"
    default-request-channel="inputChannel" />

<ws:outbound-gateway request-channel="inputChannel"
    uri="http://localhost:8080/spring-webservices-sample/endpoints" />

<int:service-activator ref="dispMess" method="display"
    input-channel="inputChannel"></int:service-activator>

Runner.java

Resource resource=new ClassPathResource("soapcall-config.xml");  
    BeanFactory factory=new XmlBeanFactory(resource);  
    WsGateway wsGateway=factory.getBean("ws", WsGateway.class);
    AccountDetailsRequest accountDetailsRequest=new AccountDetailsRequest();
    accountDetailsRequest.setAccountNumber("12345");
    wsGateway.callWS(accountDetailsRequest);

DispMess.java

public class DispMess {
    public void display(AccountDetailsResponse res){
    System.out.println(res.getAccountDetails());
}

}

WsGateway.java

public interface WsGateway {
    public void callWS(AccountDetailsRequest request);

}

即使我尝试将出站网关的 uri 更改为 web 服务的 wsdl 路径。但是错误仍然存​​在。

【问题讨论】:

    标签: soap jaxb spring-integration soap-client


    【解决方案1】:

    第一个问题:您应该启动应用程序,但XmlBeanFactory 不会为您执行此操作。

    ClassPathXmlApplicationContext 适合您的情况。

    看看Spring Integration Samples

    另一个问题:您有两个订阅 inputChannel。默认情况下DirectChannel 使用round-robin 调度策略。因此,第一条消息被发送给第一个订阅者,第二条消息被发送给第二个,依此类推。

    【讨论】:

      猜你喜欢
      • 2018-02-19
      • 2020-04-22
      • 2013-08-16
      • 2017-04-10
      • 2016-12-31
      • 1970-01-01
      • 1970-01-01
      • 2017-09-12
      • 2015-11-02
      相关资源
      最近更新 更多