[英]How do i use multiple CXF endpoints to call a webservice in Camel?
I have two endpoints: 我有两个端点:
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"
How do I implement two separate web service call after defining the endpoints. 定义端点后,如何实现两个单独的Web服务调用。 If I use both, and consume the endpoints using the routes, one of the endpoints will override the other and I am able to use only one.
如果同时使用这两个端点,并使用路由消耗端点,则其中一个端点将覆盖另一个端点,而我只能使用一个端点。 If I comment the other endpoint, Its running successfully.
如果我评论另一个端点,则它运行成功。 However I need to use both.
但是我需要同时使用两者。 I am using messageContentList for both the web service response:
我对两个Web服务响应都使用messageContentList:
MessageContentsList result = (MessageContentsList) exchange.getIn().getBody();
Thanks, please let me know if you need more information 谢谢,请让我知道是否需要更多信息
Here is the route-definition: 这是路由定义:
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();
I solved the problem. 我解决了问题。 I found out that both the endpoints were using the same beanid (cxfEndpoint) that was defined in the camel-config.xml.
我发现两个端点都使用了camel-config.xml中定义的同一个beanid(cxfEndpoint)。
I defined another id cxfEndpoint1 in camel-config.xml and used it to my endpoint and that solved the problem. 我在camel-config.xml中定义了另一个id cxfEndpoint1,并将其用于我的端点,从而解决了该问题。 Both the web-service calls are working fine without hassles.
这两个Web服务调用都可以正常工作而没有麻烦。
<bean id="cxfEndpoint" class="org.apache.camel.component.cxf.CxfEndpoint" />
<bean id="cxfEndpoint1" class="org.apache.camel.component.cxf.CxfEndpoint"/>
and here are the respective endpoints: 这是各自的端点:
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"
Thanks, 谢谢,
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.