20.4. 配置 WS-Addressing 属性
概述
Apache CXF WS-Addressing 功能元素在命名空间 http://cxf.apache.org/ws/addressing 中定义。它支持 表 20.2 “WS-Addressing 属性” 中描述的两个属性。
表 20.2. WS-Addressing 属性
| 属性名称 | 值 |
|---|---|
|
|
确定是否容许重复的 MessageID 的布尔值。默认设置为 |
|
|
指示 WSDL 中存在 |
配置 WS-Addressing 属性
通过添加属性以及您要将其设置为服务器或客户端配置文件中的 WS-Addressing 功能来配置 WS-Addressing 属性。例如,以下配置 extract 在服务器端点中将 allowDuplicates 属性设置为 false :
<beans ... xmlns:wsa="http://cxf.apache.org/ws/addressing" ...>
<jaxws:endpoint ...>
<jaxws:features>
<wsa:addressing allowDuplicates="false"/>
</jaxws:features>
</jaxws:endpoint>
</beans>使用嵌入在功能中的 WS-Policy 断言
在 例 20.3 “使用策略配置 WS-Addressing” 中,一个寻址策略断言,启用非匿名响应嵌入在 policies 元素中。
例 20.3. 使用策略配置 WS-Addressing
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:wsa="http://cxf.apache.org/ws/addressing"
xmlns:wsp="http://www.w3.org/2006/07/ws-policy"
xmlns:policy="http://cxf.apache.org/policy-config"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="
http://www.w3.org/2006/07/ws-policy http://www.w3.org/2006/07/ws-policy.xsd
http://cxf.apache.org/ws/addressing http://cxf.apache.org/schema/ws/addressing.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<jaxws:endpoint name="{http://cxf.apache.org/greeter_control}GreeterPort"
createdFromAPI="true">
<jaxws:features>
<policy:policies>
<wsp:Policy xmlns:wsam="http://www.w3.org/2007/02/addressing/metadata">
<wsam:Addressing>
<wsp:Policy>
<wsam:NonAnonymousResponses/>
</wsp:Policy>
</wsam:Addressing>
</wsp:Policy>
<policy:policies>
</jaxws:features>
</jaxws:endpoint>
</beans>