简体   繁体   English

SignedSupportingTokens wssecurity策略cxf客户端

[英]SignedSupportingTokens wssecurity policy cxf client

I'm trying to put together a small CXF client for a soap service which is having SignedSupportingTokens ws-security policy in its wsdl. 我正在尝试为肥皂服务建立一个小型CXF客户端,该客户端在其wsdl中具有SignedSupportingTokens ws-security策略。 I have configured CXF client as follows 我已经如下配置了CXF客户端

<jaxws:client id="secretService" name="{http:/mySecretServiceEndpoint//}Service" createdFromAPI="true">
        <jaxws:properties>
            <entry key="ws-security.signature.properties" value="keystore/secret.properties" />
            <entry key="ws-security.encryption.properties" value="keystore/secret.properties" />
            <entry key="ws-security.timestamp.timeToLive" value="600" />
        </jaxws:properties>
    </jaxws:client>

Unfortunately it fails to send out messages with following error. 不幸的是,它无法发出带有以下错误的消息。

Caused by: org.apache.cxf.ws.policy.PolicyException: None of the policy alternatives can be satisfied.
    at org.apache.cxf.ws.policy.EffectivePolicyImpl.chooseAlternative(EffectivePolicyImpl.java:199)
    at org.apache.cxf.ws.policy.EffectivePolicyImpl.chooseAlternative(EffectivePolicyImpl.java:192)
    at org.apache.cxf.ws.policy.EffectivePolicyImpl.initialise(EffectivePolicyImpl.java:96)
    at org.apache.cxf.ws.policy.PolicyEngineImpl.getEffectiveClientRequestPolicy(PolicyEngineImpl.java:205)
    at org.apache.cxf.ws.policy.PolicyOutInterceptor.handle(PolicyOutInterceptor.java:98)
    at org.apache.cxf.ws.policy.AbstractPolicyInterceptor.handleMessage(AbstractPolicyInterceptor.java:44)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
    at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:514)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:423)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:326)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:279)
    at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
    at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:138)

I was wondering if CXF supports SignedSupportingTokens policy by default? 我想知道CXF默认情况下是否支持SignedSupportingTokens策略? Do I need to register some handlers or am I missing something else? 我需要注册一些处理程序,还是我缺少其他功能? I don't have much experience with WS-Security and WS-SecurityPolicy , any response will be highly appreciated. 我在WS-SecurityWS-SecurityPolicy方面没有太多经验,任何回应将不胜感激。

Answering my own question as it might help somebody someday! 回答我自己的问题,因为有一天可能会有所帮助! CXF does supports SignedSupportingTokens and a lot more, In my case, service WSDL was having a different namespace for SignedSupportingTokens which CXF client dint understand (couldn't match up). CXF确实支持SignedSupportingTokens等等,在我的情况下,服务WSDL为CXF客户端dint理解(无法匹配)的SignedSupportingTokens提供了不同的命名空间。

I was able to fix the issue by using ws-security interceptors to configure the client. 通过使用ws-security拦截器来配置客户端,我能够解决此问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM