Announcement Announcement Module
No announcement yet.
Web Service Authentication with Spring-WS & JAX-WS Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Web Service Authentication with Spring-WS & JAX-WS

    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:

    <bean id="endpointMapping"
      <property name="mappings">
          <prop key="{}MyService">MyEndpoint</prop>
      <property name="interceptors">
          <bean class=""/>
          <ref local="wsSecurityInterceptor"/>
    <bean id="wsSecurityInterceptor"
      <property name="policyConfiguration" value="classpath:securityPolicy.xml"/>
      <property name="callbackHandler">
        <bean class="">
          <property name="userDetailsService" ref="securityManager"/>
    <bean id="myEndpoint" scope="prototype" class="">
      <property ref="myServiceTarget" name="myServiceTarget"/>
    <wss:binding url="/myService">
            <ws:service bean="#myEndpoint" />

    <xwss:SecurityConfiguration xmlns:xwss="">
      <xwss:RequireUsernameToken passwordDigestRequired="true" nonceRequired="true" />


    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.


  • #2
    Also the bean securityManager is an instance of a class implementing UserDetailsService which has been tested and works, I've not modified it as part if the refactor.


    • #3
      After further reading through documentation I've noticed I need to use a servlet that automatically detects EndpointMappings, WSSpringServlet does not. Here in the Sping documentation MessageDispatcherServlet is used, however I need to use WSSpringServlet to plug JAX-WS into Spring. From searching online I can't find way to use both JAX-WS and Spring-WS security together, any ideas? I'd rather not rip out all the JAX-WS stuff.
      Last edited by ollie.petch; Jan 20th, 2010, 11:16 AM.


      • #4
        How interesting... I'm planning to do the same thing, that is drop JBoss (EJB) for Spring-WS+WebMVC.

        Anyway, can't you just use both servlets? I'm sure I've seen this on the JAX-WS Commons site somewhere. I don't think WSSpringServlet is meant to be a replacement for Spring's DispatcherServlet, rather if provides Spring with JAX-WS support.

        Have a read of this and the following couple of chapters and see how it goes trying both servlets.

        Do you see the console output of Spring starting up?

        Also watch out for endpoint collision - once you get this working, it seems like you have two webservices trying to handle calls to '/myService'.

        Pls post back as I'll want to know how it's done.