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 和 Adding 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 和 Adding 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>