The first way you did it is correct, WSS4JOutInterceptor is not designed for use with WS-SecurityPolicy. The error message that you got is being thrown at the service side, so I would look into the logs to find out why the invocation is failing:
> Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Only executed ISearchQueryExecution can be checked. Colm. On Mon, Feb 16, 2015 at 5:30 PM, G.Long <[email protected]> wrote: > I updated the namespace in the wsdl file but I still get errors. > > With the code : > > Map ctx = ((BindingProvider)port).getRequestContext(); > ctx.put("ws-security.username", "login"); > ctx.put("ws-security.password", "password"); > > I get : > > Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Only > executed ISearchQueryExecution can be checked. > at org.apache.cxf.jaxws.JaxWsClientProxy.invoke( > JaxWsClientProxy.java:160) > at com.sun.proxy.$Proxy43.doQuery(Unknown Source) > at eu.europa.eurlex.search.EURLexWebServiceProvider_ > EURLexWebServicePort_Client.main(EURLexWebServiceProvider_ > EURLexWebServicePort_Client.java:69) > Caused by: org.apache.cxf.binding.soap.SoapFault: Only executed > ISearchQueryExecution can be checked. > at org.apache.cxf.binding.soap.interceptor. > Soap12FaultInInterceptor.unmarshalFault(Soap12FaultInInterceptor.java:155) > > I also tried : > > Map<String, Object> props = new HashMap<String, Object>(); > props.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN); > props.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_TEXT); > props.put(WSHandlerConstants.USER, "login"); > props.put(WSHandlerConstants.PW_CALLBACK_CLASS, > ClientPasswordCallback.class.getName()); > > WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(props); > Client client = ClientProxy.getClient(port); > client.getOutInterceptors().add(wssOut); > > and this time I get: > > AVERTISSEMENT: Interceptor for {http://eur-lex.europa.eu/ > search}EURLexWebService#{http://eur-lex.europa.eu/search}doQuery has > thrown exception, unwinding now > org.apache.cxf.ws.policy.PolicyException: No username available > at org.apache.cxf.ws.security.wss4j.AbstractTokenInterceptor. > policyNotAsserted(AbstractTokenInterceptor.java:277) > > I was wondering : is there also something related to the namespace to > change on the service side of the web service to make my client work? > > Thanks for your help :) > Regards. > > ps: sorry for the possible double post btw the mailing list and nabble. It > seems that my reply on nabble wasn't send to the mailing list... > -- Colm O hEigeartaigh Talend Community Coder http://coders.talend.com
