I added a test-case for a similar policy here that works fine in CXF 2.4.x:
http://svn.apache.org/viewvc?view=revision&revision=1157759 Colm. On Fri, Aug 12, 2011 at 2:42 PM, Daniel Kulp <[email protected]> wrote: > > What version of CXF and WSS4J are you using? This may actually be fixed in > CXF 2.4.1 as WSS4J calls back out to CXF to create the crypto if it's null. > > If this is still occurring in 2.4.x, I'd love to see a testcase. > > Dan > > > On Thursday, August 11, 2011 6:11:56 AM ovi wrote: >> When I have the policy pasted below I see a NullPointer Exception. >> When I debug the server I see that in the PolicyBasedWSS4JInInterceptor, in >> the method computeAction there is only an action computed with the values: >> "UsernameToken Timestamp " and without 'Signature'. >> I believe hat this causes the crypto object not to be found and throwing a >> NullPointerException because its null: >> This happens in the X509Security.loadCertificate in the line cachedCert = >> crypto.loadCertificate(in); >> The crypto is null and there is a NullPointerEception. >> >> Are my assumptions correct ???? Is this policy possible to execute ? >> >> >> My wsdlis, my client and my server are pasted below: >> 1. client.xml >> <jaxws:client id="careReceiverInsurabilityWSClient" >> >> serviceClass="be.cin.mycarenet.esb.insurability.InsurabilityPortType" >> >> address="https://localhost:8443/jbossWsCxfClientWithWSSecurityPolicyHttps-1/ >> CareReceiverInsurabilityWebserviceImpl" >> wsdlLocation="wsdl/MyCarenet-Insurability.wsdl" >> endpointName="s:InsurabilityPort" >> serviceName="s:CareReceiverInsurability" >> xmlns:s="urn:be:cin:mycarenet:esb:insurability"> >> <jaxws:properties> >> <entry key="ws-security.username" value="ovione"/> >> <entry key="ws-security.callback-handler" >> value="poc.samples.jboss.cxf.ejb.sync.security.policy.webservice.callbackHan >> dlers.client.UsernameTokenCallbackHandlerClient"/> <entry >> key="ws-security.signature.properties" >> value="security/clientSign.properties"/> >> <entry key="ws-security.signature.username" > value="pairclient"/> >> </jaxws:properties> >> </jaxws:client> >> >> 2. server.xml >> <jaxws:endpoint >> id="careReceiverInsurabilityWSServer" >> >> implementor="poc.samples.jboss.cxf.ejb.sync.security.policy.webservice.CareR >> eceiverInsurabilityWebserviceImpl" >> >> address="https://localhost:8443/jbossWsCxfClientWithWSSecurityPolicyHttps-1/ >> CareReceiverInsurabilityWebserviceImpl" >> wsdlLocation="wsdl/MyCarenet-Insurability.wsdl" >> endpointName="s:InsurabilityPort" >> serviceName="s:CareReceiverInsurability" >> xmlns:s="urn:be:cin:mycarenet:esb:insurability"> >> <jaxws:properties> >> <entry key="ws-security.callback-handler" >> value="poc.samples.jboss.cxf.ejb.sync.security.policy.webservice.callbackHan >> dlers.server.UsernameTokenCallbackHandlerServer"/> <entry >> key="ws-security.signature.properties" >> value="security/serverSignVerify.properties"/> >> <entry key="ws-security.signature.username" > value="clienttrusted"/> >> </jaxws:properties> >> </jaxws:endpoint> >> >> 3. policy in the wsdl >> <wsp:Policy wsu:Id="BasicSecurityPolicy"> >> <wsp:ExactlyOne> >> <wsp:All> >> <sp:TransportBinding> >> <wsp:Policy> >> <sp:TransportToken> >> <wsp:Policy> >> <sp:HttpsToken > RequireClientCertificate="false" /> >> </wsp:Policy> >> </sp:TransportToken> >> <sp:Layout> >> <wsp:Policy> >> <sp:Lax /> >> </wsp:Policy> >> </sp:Layout> >> <sp:IncludeTimestamp /> >> <sp:AlgorithmSuite> >> <wsp:Policy> >> <sp:Basic128 /> >> </wsp:Policy> >> </sp:AlgorithmSuite> >> </wsp:Policy> >> </sp:TransportBinding> >> <sp:EndorsingSupportingTokens> >> <wsp:Policy> >> <sp:X509Token >> sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/Includ >> eToken/AlwaysToRecipient"> <wsp:Policy> >> >> <sp:WssX509V3Token10 /> >> </wsp:Policy> >> </sp:X509Token> >> </wsp:Policy> >> </sp:EndorsingSupportingTokens> >> <sp:SignedSupportingTokens> >> <wsp:Policy> >> <sp:UsernameToken >> sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/Includ >> eToken/AlwaysToRecipient"> <wsp:Policy> >> >> <sp:WssUsernameToken10 /> >> </wsp:Policy> >> </sp:UsernameToken> >> </wsp:Policy> >> </sp:SignedSupportingTokens> >> >> >> -- >> View this message in context: >> http://cxf.547215.n5.nabble.com/EndorsingSupportingTokens-and-SignedSupport >> ingTokens-throing-a-Nullpointer-exception-tp4689470p4689470.html Sent from >> the cxf-dev mailing list archive at Nabble.com. > -- > Daniel Kulp > [email protected] > http://dankulp.com/blog > Talend - http://www.talend.com > -- Colm O hEigeartaigh http://coheigea.blogspot.com/ Talend - http://www.talend.com
