第 324 章 Spring WebService Component

可作为 Camel 版本 2.6 提供。

重要

Red Hat JBoss Enterprise Application Platform (JBoss EAP)容器 不支持 Camel WebService, camel-spring-ws。如果您需要在 JBoss EAP 容器上实施 JAX-WS 端点,建议的方法是使用内置于 JBoss EAP 容器中的 Web 服务 子系统。这种方法会自动为您提供企业级的服务(包括管理、安全性等等)。如果您随后需要将 JAX-WS 端点与 Camel 路由集成,您可以在初始有效负载处理后将生成的 EndpointImpl bean 传递给 Camel 路由。

spring-ws: 组件允许您与 Spring Web Services 集成。它提供对 客户端的支持、访问 Web 服务和 服务器(包括创建您自己的合同优先 Web 服务)的支持。

Maven 用户需要将以下依赖项添加到其 pom.xml 中:

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-spring-ws</artifactId>
    <version>x.x.x</version>
    <!-- use the same version as your Camel core version -->
</dependency>

INFO:*Dependencies* As of Camel 2.8 this component with Spring-WS 2.0.x (与 Camel 的其余部分相同)需要 Spring 3.0.x。较早版本的 Camel 版本发布了 Spring-WS 1.5.9,它与 Spring 2.5.x 和 3.0.x 兼容。要在 Spring 2.5.x 上运行较早版本的 camel-spring-ws,您需要添加 Spring 2.5.x 中的 spring-webmvc 模块。要在 Spring 3.0.x 上运行 Spring-WS 1.5.9,您需要从 Spring 3.0.x 排除 OXM 模块,因为此模块也包含在 Spring-WS 1.5.9 中(请参阅 此后期

324.1. URI 格式

此组件的 URI 方案如下

spring-ws:[mapping-type:]address[?options]

要公开 web 服务 映射类型,需要设置为以下任意一种:

映射类型描述

rootqname

提供 选项,以根据消息中包含的根元素的限定名称来映射 Web 服务请求。

soapaction

用于映射基于消息标题中指定的 SOAP 操作的 Web 服务请求。

uri

映射以特定 URI 为目标的 Web 服务请求。

xpathresult

用于根据对传入消息的 XPath 表达式 的评估来映射 Web 服务请求。评估结果应与端点 URI 中指定的 XPath 结果匹配。

beanname

允许您引用 org.apache.camel.component.spring.ws.bean.CamelEndpointDispatcher 对象,以便与现有的(legacy) 端点映射 (如 PayloadRootQNameEndpointMappingSoapActionEndpointMapping 等等)集成

作为使用者,该地址 应包含与指定映射类型相关的值(例如,SOAP 操作,XPath 表达式)。作为制作者,地址应设置为您调用的 Web 服务的 URI。

您可以使用以下格式在 URI 中附加查询 选项 ?option=value&option=value&…​