You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Landslide <xi...@landslide.com> on 2008/03/05 22:43:55 UTC

NullPointerException after cxfEndpoint.getOutInterceptors().clear()

If I have a CXF client which is set as
(BindingProvider.SESSION_MAINTAIN_PROPERTY, true), I do not want the client
to send the following <soap:Header> tag for all subsequent requests after
the first successful request:

<soap:Header>
<wsse:Security
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
soap:mustUnderstand="1">
</wsse:Security>
</soap:Header>

If I do so by:
cxfEndpoint.getOutInterceptors().clear();
the CXF API gives me an erorr as below: 
Mar 5, 2008 4:20:14 PM org.apache.cxf.phase.PhaseInterceptorChain
doIntercept
INFO: Interceptor has thrown exception, unwinding now
java.lang.NullPointerException

If I use an SOAP client coded with the Axis2 API, I can do so after the
first successful request with no issue by calling:
client.disengageModule("rampart");

It seems to me that the CXF API should check if the list of OutInterceptors
is empty or not, and would do nothing if it is indeed empty.
-- 
View this message in context: http://www.nabble.com/NullPointerException-after-cxfEndpoint.getOutInterceptors%28%29.clear%28%29-tp15861038p15861038.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: NullPointerException after cxfEndpoint.getOutInterceptors().clear()

Posted by Landslide <xi...@landslide.com>.
Thanks for your help, Dan!

Doing the following does get what I wanted:
     cxfEndpoint.getOutInterceptors().remove(wss4jOut);
     cxfEndpoint.getOutInterceptors().remove(saajOut);

-- 
View this message in context: http://www.nabble.com/NullPointerException-after-cxfEndpoint.getOutInterceptors%28%29.clear%28%29-tp15861038p15872143.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: NullPointerException after cxfEndpoint.getOutInterceptors().clear()

Posted by Daniel Kulp <dk...@apache.org>.
The issue is that you are probably clearing out a bunch of interceptors 
(like all the soap interceptors) that need to be there.   Most likely, 
the null pointer is not due to it being empty, but due to something else 
expecting a particular interceptor to be there.

Before calling clear, can you see which interceptors are there?   In 
general, only remove the interceptors that you added.

Dan


On Wednesday 05 March 2008, Landslide wrote:
> If I have a CXF client which is set as
> (BindingProvider.SESSION_MAINTAIN_PROPERTY, true), I do not want the
> client to send the following <soap:Header> tag for all subsequent
> requests after the first successful request:
>
> <soap:Header>
> <wsse:Security
> xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-ws
>security-secext-1.0.xsd" soap:mustUnderstand="1">
> </wsse:Security>
> </soap:Header>
>
> If I do so by:
> cxfEndpoint.getOutInterceptors().clear();
> the CXF API gives me an erorr as below:
> Mar 5, 2008 4:20:14 PM org.apache.cxf.phase.PhaseInterceptorChain
> doIntercept
> INFO: Interceptor has thrown exception, unwinding now
> java.lang.NullPointerException
>
> If I use an SOAP client coded with the Axis2 API, I can do so after
> the first successful request with no issue by calling:
> client.disengageModule("rampart");
>
> It seems to me that the CXF API should check if the list of
> OutInterceptors is empty or not, and would do nothing if it is indeed
> empty.



-- 
J. Daniel Kulp
Principal Engineer, IONA
dkulp@apache.org
http://www.dankulp.com/blog