I have an issue I don't understand trying to use security with SoapActionEndpointMapping. My endpoint works without security.
When I add SimplePasswordValidationCallbackHandler it seems to prohibit the endpoint if I don't call it with the correct username and password. When I do call it with the correct username and password however, I get
... Could not validate request: java.lang.NullPointerException;
...
my endpoint works and returns the result when my bean looks like this (security commented out):
Code:
<bean id="secureMapping" class="org.springframework.ws.soap.endpoint.mapping.SoapActionEndpointMapping">
<property name="mappings">
<props>
<prop key="http://www.uptodate.com/topicRetrieve">
topicRetrieveEndpoint
</prop>
</props>
</property>
<!-- <property name="interceptors">
<list>
<bean class="org.springframework.ws.soap.endpoint.interceptor.SoapEnvelopeLoggingInterceptor"/>
<ref local="wsSecurityInterceptor"/>
</list>
</property>
-->
</bean>
However when I uncomment the interceptors property info my logging works, and it seems the security interceptor kicks in.
That bean looks like this:
Code:
<bean id="wsSecurityInterceptor"
class="org.springframework.ws.soap.security.xwss.XwsSecurityInterceptor">
<property name="policyConfiguration" value="classpath:securityPolicy.xml"/>
<property name="secureResponse" value="false" />
<property name="callbackHandlers">
<list>
<ref bean="passwordValidationHandler" />
</list>
</property>
</bean>
with the passwordValidationHandler (for simple testing) defined as
Code:
<bean id="passwordValidationHandler"
class="org.springframework.ws.soap.security.xwss.callback.SimplePasswordValidationCallbackHandler">
<property name="users">
<props>
<prop key="Bert">Ernie</prop>
</props>
</property>
</bean>
If I call my web service with the username Bert and an incorrect password, I get
"SEVERE: WSS1408: UsernameToken Authentication Failed"
which seems correct.
If I then change my username and password to be correct, I get the following error:
...<SOAP-ENV:Fault><faultcode>SOAP-ENV:Client</faultcode><faultstring xml:lang="en">java.lang.NullPointerException; nested exception is com.sun.xml.wss.XWSSecurityException: java.lang.NullPointerException</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
Can anyone help me understand what I should look at to fix this?
Thanks ... Rich