20.3. 启用 WS-Addressing
概述
要启用 WS-Addressing 拦截器,必须将 WS-Addressing 拦截器添加到入站和出站拦截器链中。这可以通过以下之一完成:
- Apache CXF 功能
- RMAssertion 和 WS-Policy Framework
- 在 WS-Addressing 功能中使用 Policy Assertion
将 WS-Addressing 添加为功能
通过在客户端和服务器配置中添加 WS-Addressing 功能来启用 WS-Addressing,如 例 20.1 “client.xml 并为客户端配置添加 WS-Addressing 功能” 和 例 20.2 “server.xml 并添加到服务器配置的 WS-Addressing 功能” 所示。
例 20.1. client.xml 并为客户端配置添加 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:jaxws="http://cxf.apache.org/jaxws" xmlns:wsa="http://cxf.apache.org/ws/addressing" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://cxf.apache.org/ws/addressing http://cxf.apache.org/schemas/ws-addr-conf.xsd"> <jaxws:client ...> <jaxws:features> <wsa:addressing/> </jaxws:features> </jaxws:client> </beans>
例 20.2. server.xml 并添加到服务器配置的 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:jaxws="http://cxf.apache.org/jaxws" xmlns:wsa="http://cxf.apache.org/ws/addressing" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <jaxws:endpoint ...> <jaxws:features> <wsa:addressing/> </jaxws:features> </jaxws:endpoint> </beans>