311.6.2. WebService Server
使用以下路由,设置 Webservice 服务器,该服务器侦听 jms 队列 customerServiceQueue,并使用类 CustomerServiceImpl 进行处理请求。customerServiceImpl of 课程实施接口客户服务。它不直接实例化服务器类,而是可以作为常规 bean 在 spring 上下文中定义。
SoapJaxbDataFormat soapDF = new SoapJaxbDataFormat("com.example.customerservice", new ServiceInterfaceStrategy(CustomerService.class));
CustomerService serverBean = new CustomerServiceImpl();
from("jms://queue:customerServiceQueue")
.onException(Exception.class)
.handled(true)
.marshal(soapDF)
.end()
.unmarshal(soapDF)
.bean(serverBean)
.marshal(soapDF);