【发布时间】:2013-03-22 12:35:25
【问题描述】:
我正在学习 Webservice 安全性。我正在为此使用 CXF 框架。我开发了一项测试服务,无论我们发送什么,它都会使价值翻倍。基于本教程
我已经为 XML 加密和签名添加了 WS-Policy。
然后,我使用 CXF 将此服务的 Web 服务客户端开发为 Eclipse 项目。 以下是我的客户端配置文件
<jaxws:client id="doubleItClient" serviceClass="com.DoubleIt" address="http://localhost:8080/myencws/services/DoubleItPort?wsdl">
<jaxws:features>
<bean class="org.apache.cxf.feature.LoggingFeature" />
</jaxws:features>
<jaxws:properties>
<entry key="ws-security.callback-handler" value="com.ClientKeystorePasswordCallback"/>
<entry key="ws-security.encryption.properties" value="com/clientKeystore.properties"/>
<entry key="ws-security.signature.properties" value="com/clientKeystore.properties"/>
<entry key="ws-security.encryption.username" value="myservicekey"/>
</jaxws:properties>
我已经生成了所有的keystore文件,我创建了clientKeystore.properties文件并放在了我项目的src目录中。
但是每当我运行这个客户端时,SOAP 请求消息都没有加密。所以旅馆服务器端我得到了像
这样的异常无法满足以下备选政策: {http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}加密部分 {http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}SignedParts
以下是我的 SOAP 请求
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:doubleValue
xmlns:ns2="http://com/"><arg0>5</arg0></ns2:doubleValue></soap:Body></soap:Envelope>
我正在使用 CXF2.7.3。我不知道怎么了。请帮帮我。
【问题讨论】:
标签: cxf xml-encryption