The NPE is because there is no Message Exchange set on the SoapMessage. I'll fix the NPE. In the meantime you could add in the following to your code:
Exchange ex = new ExchangeImpl(); ex.setInMessage(message); See for example: https://github.com/apache/cxf/blob/3.1.x-fixes/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JInOutTest.java By the way, the wsse namespace you are using in the sample is from a very old standard and won't work. It should be xmlns:wsse=" http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" instead. Colm. On Wed, Apr 19, 2017 at 8:59 PM, Sandun Perera <[email protected]> wrote: > HI All > > I'm working on a project which uses a CXF SoapMessage generated form a > string. I'm trying use Username Token Validation but it throws > *NullPointerException. > *This is the source code [1] > <https://gist.github.com/anonymous/bfb6f65194a030a50681af175a9937f5> I > used. I pass a SOAP message [2] > <https://gist.github.com/anonymous/f704db6147e02acdff323dc67ccff6d6> as a > string to *initiateComplianceCheck* method and it then convert it to a CXF > SoapMessage object and use it for Username Token authentication. > > [1] https://gist.github.com/anonymous/bfb6f65194a030a50681af175a9937f5 > [2] https://gist.github.com/anonymous/f704db6147e02acdff323dc67ccff6d6 > > But CXF handleMessage gives a NullPointerException > > This is a part of the error message thrown > > java.lang.NullPointerException > > at > > org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.handleMessage( > WSS4JInInterceptor.java:165) > > > Appreciate if you can help me to solve this issue > > Regards > -- Colm O hEigeartaigh Talend Community Coder http://coders.talend.com
