I've been given the task to refactor some code on a project I'm working on and part of that was to remove jboss web service authentication and replace it with spring-ws authentication. Currently I'm trying to setup endpoint mapping in an application to intercept requests with XwsSecurityInterceptor to ensure a username token is given in the SOAP header. My XML config is shown below:
spring-web-services.xml
Code:<bean id="endpointMapping" class="org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping"> <property name="mappings"> <props> <prop key="{http://my.domain.co.uk/}MyService">MyEndpoint</prop> </props> </property> <property name="interceptors"> <list> <bean class="org.springframework.ws.server.endpoint.interceptor.PayloadLoggingInterceptor"/> <ref local="wsSecurityInterceptor"/> </list> </property> </bean> <bean id="wsSecurityInterceptor" class="org.springframework.ws.soap.security.xwss.XwsSecurityInterceptor"> <property name="policyConfiguration" value="classpath:securityPolicy.xml"/> <property name="callbackHandler"> <bean class="org.springframework.ws.soap.security.xwss.callback.SpringDigestPasswordValidationCallbackHandler"> <property name="userDetailsService" ref="securityManager"/> </bean> </property> </bean> <bean id="myEndpoint" scope="prototype" class="com.my.company.webservices.MyEndpoint"> <property ref="myServiceTarget" name="myServiceTarget"/> </bean> <wss:binding url="/myService"> <wss:service> <ws:service bean="#myEndpoint" /> </wss:service> </wss:binding>
securityPolicy.xml
Code:<xwss:SecurityConfiguration xmlns:xwss="http://java.sun.com/xml/ns/xwss/config"> <xwss:RequireUsernameToken passwordDigestRequired="true" nonceRequired="true" /> </xwss:SecurityConfiguration>
web.xml
Code:<listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <servlet> <servlet-name>jaxws-servlet</servlet-name> <servlet-class>com.sun.xml.ws.transport.http.servlet.WSSpringServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>jaxws-servlet</servlet-name> <url-pattern>/myService</url-pattern> </servlet-mapping>
I assume the mapping is not working correctly their is no indication wsSecurityInterceptor is being called at all so I added the PayloadLoggingInterceptor but nothing is logged in the Jboss console when I make a request using SOAP UI.
Is their something I'm missing or a error with my configuration, I'm new to both Spring and web services in general so if theirs anything else I need to help to diagnose the problem let me know.
Ollie.


Reply With Quote
