cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: [newbie question] CXFNonSpringServlet and ws-security
Date Wed, 03 Nov 2010 15:24:25 GMT


What version of CXF?   At one point, there was a bug where interceptors added 
to the endpoint directly didn't get added to the chain.  Make sure you are 
using 2.3.0.

Also, in your code below, you are not setting any actions on the 
Wss4jInInterceptor.  Thus, it may be bailing out fast as its not supposed to 
do any actions.

Dan


On Wednesday 03 November 2010 5:24:49 am siuyab wrote:
> Dear all,
> 
> Actually I posted this question under different thread, but I think it's
> better to start as a new thread.
> 
> I have to say that I am new to web service and CXF stuff. I currently
> trying to add simple username token of ws-security on an already developed
> code which is using CXFNonSpringServlet.
> 
> In the override loadBus method, the endpoint is published in this way:
> javax.xml.ws.Endpoint.publish("/query", service);
> 
> Then I followed the ws-security example as written in following website,
> without configuring the Spring:
> https://cwiki.apache.org/CXF20DOC/ws-security.html#WS-Security-addintercept
> ors
> 
> ws-security configuration at server side was also done in the loadBus
> method.
> 
> At the server side however, I didn't follow exactly the same think as shown
> in the example because in the example Endpoint refers to
> org.apache.cxf.endpoint.Endpoint, but in the code it refers to
> javax.xml.ws.Endpoint. So, here is the slightly modified code:
> 
> 
> EndpointImpl jaxwsEndpoint = (EndpointImpl)Endpoint.publish("/query",
> service);
> Endpoint cxfEndpoint = (Endpoint) jaxwsEndpoint.getServer().getEndpoint();
> 
> /** Adding Incoming Interceptors */
> Map<String,Object> inProps= new HashMap<String,Object>();
> 
> WSS4JInInterceptor wssIn = new WSS4JInInterceptor(inProps);
> ((EndpointImpl) cxfEndpoint).getInInterceptors().add(wssIn);
> 
> 
> I got the following error when client tries to execute the method in web
> service:
> 
> 
> Caused by: org.apache.cxf.binding.soap.SoapFault: MustUnderstand headers:
> [{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext
> -1.0.xsd}Security] are not understood.
>         at
> org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.unmarshalF
> ault(Soap11FaultInInterceptor.java:75) at
> org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMess
> age(Soap11FaultInInterceptor.java:46) at
> org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMess
> age(Soap11FaultInInterceptor.java:35) at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChai
> n.java:243) at
> org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(Ab
> stractFaultChainInitiatorObserver.java:99) at
> org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage
> (CheckFaultInterceptor.java:69) at
> org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage
> (CheckFaultInterceptor.java:34) at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChai
> n.java:243) at
> org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:700) at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleRespons
> eInternal(HTTPConduit.java:2261) at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleRespons
> e(HTTPConduit.java:2134) at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPCon
> duit.java:1988) at
> org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
>         at
> org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:639)
>         at
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInte
> rceptor.handleMessage(MessageSenderInterceptor.java:62) at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChai
> n.java:243) at
> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:487) at
> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:313) at
> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:265) at
> org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
>         at
> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
>         ... 30 more
> 
> Can somebody give some clue on how to solve this issue please? Perhaps this
> is very basic or stupid question, but any help will be appreciated.
> 
> Regards,
> Bayu

-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog

Mime
View raw message