Hi to all!
I'm a begginer of web services and UsernameToken security policy !!!
I'm trying to create a client web service using CXF 2.5.0 and when
I test it with I receive the following error inside Eclipse console:
Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: None of the
policy alternatives can be satisfied.
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke
(JaxWsClientProxy.java:156)
at $Proxy28.requestChunkedUpload(Unknown Source)
at it.racomputer.sara.services.action.proveSSL.wsCall.call
(wsCall.java:120)
at it.racomputer.sara.services.action.proveSSL.wsCall.main
(wsCall.java:135)
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:170)
at org.apache.cxf.ws.policy.EffectivePolicyImpl.chooseAlternative
(EffectivePolicyImpl.java:163)
at org.apache.cxf.ws.policy.EffectivePolicyImpl.initialise
(EffectivePolicyImpl.java:89)
at
org.apache.cxf.ws.policy.PolicyEngineImpl.getEffectiveClientRequestPolicy
(PolicyEngineImpl.java:202)
at org.apache.cxf.ws.policy.PolicyOutInterceptor.handle
(PolicyOutInterceptor.java:112)
at org.apache.cxf.ws.policy.AbstractPolicyInterceptor.handleMessage
(AbstractPolicyInterceptor.java:45)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept
(PhaseInterceptorChain.java:263)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:535)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:465)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:368)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:321)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:88)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke
(JaxWsClientProxy.java:134)
... 3 more
Even if inside my client java I have used an interceptor to set the
usernametoken, in this way:
xxxxxx port = service.getPort();
service.getHandlerResolver();
org.apache.cxf.endpoint.Client client = ClientProxy.getClient(port);
org.apache.cxf.endpoint.Endpoint cxfEndpoint = client.getEndpoint();
cxfEndpoint.getInInterceptors().add(new LoggingInInterceptor());
cxfEndpoint.getOutInterceptors().add(new LoggingOutInterceptor());
Map<String,Object> outProps= new HashMap<String,Object>();
outProps.put(WSHandlerConstants.ACTION,"UsernameToken Timestamp");
outProps.put(WSHandlerConstants.USER, "admin");
outProps.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_TEXT);
outProps.put
(WSHandlerConstants.USERNAME_TOKEN,ClientPasswordCallback.class.getName());
//Set the properties on the interceptor
WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps);
cxfEndpoint.getOutInterceptors().add(wssOut);
...
Can anyone hel me?
Thanks,
Nadia