Hi,

It seems your environment messed up JAXWS RI and CXF.
Please check your CXF dependencies.

Cheers,
Andrei.

> -----Original Message-----
> From: adamcchang [mailto:[email protected]]
> Sent: Dienstag, 12. März 2013 04:17
> To: [email protected]
> Subject: RE: Interceptors for WS security
> 
> Thank you guys for the help.  However I am having this issue when I tried to
> add WSS4JOutInterceptor to my WS client.  I followed the example in
> Mazza's blog.
> 
> Exception in thread "main" java.lang.ClassCastException:
> com.sun.xml.internal.ws.client.sei.SEIStub cannot be cast to
> org.apache.cxf.frontend.ClientProxy
> 
> 
>       Map ctx =
> ((BindingProvider)uciRoleServiceSOAP).getRequestContext();
>       ctx.put("ws-security.username", "joe");
>       ctx.put("ws-security.callback-handler",
> ClientPasswordCallback.class.getName());
>       // instead of above line can also do:
>       // ctx.put("ws-security.password", "joespassword");
> 
> 
>     // Alternative CXF interceptor config method
>       org.apache.cxf.endpoint.Client client =
> org.apache.cxf.frontend.ClientProxy.getClient(uciRoleServiceSOAP);  <====
> this is where the error happens
>     org.apache.cxf.endpoint.Endpoint cxfEndpoint = client.getEndpoint();
>     Map outProps = new HashMap();
>     outProps.put(WSHandlerConstants.ACTION,
> WSHandlerConstants.USERNAME_TOKEN);
>     outProps.put(WSHandlerConstants.USER, "joe");
>     outProps.put(WSHandlerConstants.PASSWORD_TYPE,
> WSConstants.PW_TEXT);
>     outProps.put(WSHandlerConstants.PW_CALLBACK_CLASS,
> ClientPasswordCallback.class.getName());
>     WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps);
>     cxfEndpoint.getOutInterceptors().add(wssOut);
> 
> 
> I have my client code (UciRoleServiceSOAP_Service
> uciRoleServiceSOAP_Service
> ) generated by wsdl2java.  Could anybody help me on how to get the
> cxfclient from a wsdl2java code please?  Thanks a lot.
> 
> Regards,
> 
> ~Adam
> 
> 
> 
> 
> 
> 
> 
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/Interceptors-for-WS-security-
> tp5722285p5724423.html
> Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to