Reputation: 438
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. 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:
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();
Upvotes: 1
Views: 1375
Reputation: 438
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.
I defined another id cxfEndpoint1 in camel-config.xml and used it to my endpoint and that solved the problem. Both the web-service calls are working fine without hassles.
<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,
Upvotes: 1