Hi all.

Any idea?

I am doing some tests with CXF 2.7.1.
Using a DynamicClientFactory, I am constructing a dynamic client for
sending messages from a WSDL that has a policy on binding, which
includes UsernameToken.

However, when invoking an operation, I get:
org.apache.cxf.ws.policy.PolicyException: None of the policy
alternatives can be satisfied.

While researching this, I noticed that
PolicyEngine.supportsAlternative() stumbles upon
"{http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}UsernameToken is
not supported" (it is not in PolicyInterceptorProviderRegistry of the
client's Bus).

How should this be handled properly? Or is this case generally not
supported? Is there some good documentation about which features the CXF
clients and servers support and how to configure them?

For server dynamically generated from the same WSDL, the UsernameToken
policy is processed correctly.

    <wsp:Policy wsu:Id="MyPolicy">
        <wsp:ExactlyOne>
            <sp:UsernameToken
               
sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient";>
                <wsp:Policy>
                    <sp:WssUsernameToken10 />
                    <sp:HashPassword />
                    <!--sp:RequireDerivedKeys / -->
                </wsp:Policy>
            </sp:UsernameToken>
        </wsp:ExactlyOne>
    </wsp:Policy>

Reply via email to