第一次调用后,Camel CxfEndpoint设置地址不起作用

时间:2016-06-15 08:30:33

标签: web-services apache-camel cxf

我希望每次到达端点bean时设置地址。当我第一次调用setAddress时它会工作,在该地址和端点url更改之后但是ws调用转到了第一个addres。这是我的代码

@Bean
public CxfEndpoint xWSwithoutAddress() {
    final CxfEndpoint endpoint = new CxfEndpoint();
    endpoint.setServiceClass(IntegrationSoap.class);
    return endpoint;
}

@Bean
@Scope(value="prototype",proxyMode = ScopedProxyMode.TARGET_CLASS)
public CxfEndpoint xWS() {
    XSettings settings = configFileManager.readSettings(XSettings.class);
    final CxfEndpoint endpoint = xWSwithoutAddress();
    endpoint.setAddress(settings.getWsdlAddress());
    return endpoint;
}

和路线

from("direct:getEbysServices")
        .to("cxf:bean:xWS?wrapped=true&loggingFeatureEnabled=true");

1 个答案:

答案 0 :(得分:0)

停止和开始路线解决了我的问题。

我给路线一个id

from("direct:getEbysServices")
        .routeId("ebysRoute")
        .to("cxf:bean:xWS?wrapped=true&loggingFeatureEnabled=true");

当地址改变时,我停下来开始路线。

camelContext.stopRoute("ebysRoute");
camelContext.startRoute("ebysRoute");