Ok, we've advanced a bit on the subject.
Our need here is to configure WS-Security JAX-WS handler and an additional custom handler in spring configuration files.
We're using JAX-WS2 on JEE5 (no Spring Web Services).
With JEE5 specification, in order to configure server side JAX-WS handlers, we need to use @HandlerChain which links to a handler-chain file.
The handler-chain file contains the list of jax-ws handlers which will be executed.
The problem is we really want to configure our handlers in spring configuration, and not in this handler-chain.xml file.
So, we have written a delegating handler (ServerDelegatingSoapHandler).
The limitation of our handler is that it cannot be configured (we cannot configure handlers in the handler-chain.xml, this really sucks - perhaps we missed sthing on the spec, but I doubt it).
For instance :
. service implementation :
Code:
@javax.jws.WebService (blabla)
@HandlerChain(file="handler-chain.xml")
public class PortefeuilleService1SOAPImpl extends SpringBeanAutowiringSupport{
. sample handler-chain.xml file
Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<javaee:handler-chains xmlns:javaee="http://java.sun.com/xml/ns/javaee"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<javaee:handler-chain>
<javaee:handler>
<javaee:handler-class>
com.blabla.integration.remoting.jaxws.handler.ServerDelegatingSoapHandler
</javaee:handler-class>
</javaee:handler>
</javaee:handler-chain>
</javaee:handler-chains>
And spring configuration file (ServerDelegatingSoapHandler always call handler chain with name serverHandlers) :
Code:
<util:list id="serverHandlers">
<bean class="com.blabla.integration.remoting.jaxws.handler.security.wss4j.ServerWss4jHandler">
<property name="wss4jSecurityInterceptor" ref="wss4jSecurityInterceptor"/>
</bean>
<bean class="com.blabla.integration.remoting.jaxws.handler.context.ServerExecutionContextSoapHandler"/>
</util:list>
<bean id="wss4jSecurityInterceptor" class="com.blabla.integration.remoting.jaxws.handler.security.wss4j.Wss4jSecurityInterceptor">
<property name="validationActions" value="UsernameToken "/>
<property name="securementActions" value="UsernameToken"/>
<property name="securementUsername" value="pipo"/>
<property name="securementPassword" value="bimbo"/>
<property name="validationCallbackHandler">
<bean class="com.blabla.integration.remoting.jaxws.handler.security.wss4j.callback.SimplePasswordValidationCallbackHandler">
<property name="users">
<props>
<prop key="Bert">Ernie</prop>
<prop key="pipo">bimbo</prop>
</props>
</property>
</bean>
</property>
</bean>
So, once more this configuration works, but :
- the developer needs to know ServerDelegatingSoapHandler always call a handler chain with id serverHandlers. This is a bit 'magical'.
- the class ServerDelegatingSoapHandleralways call the same handler chain. If we need to have multiple handler chains in our application, we need to code an additionnal class (i.e ServerDelegatingSoapHandler2 calling serverHandlers2).
So, this solution is far from ideal.
Do you think about a better solution ?
Has anyone before configured serveur side JAX-WS handlers with spring ?
Thanks !