使用以下路由设置 Web 服务服务器,该服务器侦听 jms 队列 customerServiceQueue,并使用类 customerServiceImpl 处理请求。客户服务课程应实施接口 CustomerService。它可以在 spring 上下文中定义,而不是直接实例化服务器类,而是作为常规 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);
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);
Copy to ClipboardCopied!Toggle word wrapToggle overflow