繁体   English   中英

如何使用多个CXF端点在Camel中调用Web服务?

[英]How do i use multiple CXF endpoints to call a webservice in Camel?

我有两个端点:

CXF_FIRST_ENDPOINT="cxf:bean:cxfEndpoint?{address=first_address}&serviceClass=com.service.class.first"
CXF_SECOND_ENDPOINT="cxf:bean:cxfEndpoint?{address=second_address}&serviceClass=com.service.class.second"

定义端点后,如何实现两个单独的Web服务调用。 如果同时使用这两个端点,并使用路由消耗端点,则其中一个端点将覆盖另一个端点,而我只能使用一个端点。 如果我评论另一个端点,则它运行成功。 但是我需要同时使用两者。 我对两个Web服务响应都使用messageContentList:

MessageContentsList result = (MessageContentsList) exchange.getIn().getBody();

谢谢,请让我知道是否需要更多信息


这是路由定义:

from("direct:paymentInfo").routeId("PaymentInfo") 
    .bean(billingServiceProcessor, "processBillingPaymentRequest") 
    .to(CXF_BILLINGSERVICE_ENDPOINT)
    .bean(billingServiceProcessor, "processBillingPaymentResponse")
    .end();

from("direct:Holidays").routeId("HolidayRetrieval") 
    .bean(entityProcessor, "processHolidaysRequest") 
    .to(CXF_ENTITYSERVICE_ENDPOINT)
    .bean(entityProcessor, "processHolidaysResponse")
    .end();

我解决了问题。 我发现两个端点都使用了camel-config.xml中定义的同一个beanid(cxfEndpoint)。

我在camel-config.xml中定义了另一个id cxfEndpoint1,并将其用于我的端点,从而解决了该问题。 这两个Web服务调用都可以正常工作而没有麻烦。

<bean id="cxfEndpoint" class="org.apache.camel.component.cxf.CxfEndpoint" />
<bean id="cxfEndpoint1" class="org.apache.camel.component.cxf.CxfEndpoint"/>

这是各自的端点:

CXF_FIRST_ENDPOINT="cxf:bean:cxfEndpoint?{address=first_address}&serviceClass=com.service.class.first"
CXF_SECOND_ENDPOINT="cxf:bean:cxfEndpoint1?{address=second_address}&serviceClass=com.service.class.second"

谢谢,

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM