119.15. 公开 Web 服务
要使用此组件公开 Web 服务,您必须首先设置一个 MessageDispatcher,以便在 Spring XML 文件中查找端点映射。如果要在 servlet 容器中运行,则必须使用 web.xml 中配置的 MessageDispatcherServlet。
默认情况下,MessageDispatcherServlet 将查找名为 /WEB-INF/spring-ws-servlet.xml 的 Spring XML。要将 Camel 与 Spring-WS 搭配使用,该 XML 文件中唯一的强制 bean 是 CamelEndpointMapping。此 bean 允许 MessageDispatcher 将 Web 服务请求分配给您的路由。
web.xml
spring-ws-servlet.xml
有关设置 Spring-WS 的更多信息,请参阅 Writing Contract-First Web Services。基本段落 3.6 "Implementing the Endpoint" 由此组件处理(特别是段落 3.6.2"向 Endpoint 进行"恢复消息"是 CamelEndpointMapping 所在的位置。请参阅 Camel 分发中包含的 Spring Web 服务示例。