Spring WS “Le jeton de sécurité n'a pas pu être authentifié ou autorisé”

Je suis de la création d'un client java consommateur pour un service web à l'aide de SpringWS de Sécurité.

Ma Demande de SAVON (Que j'utilise SOAP UI)

<soapenv:Envelope 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
         xmlns:sch="http://myws.mycompany.com/myws/schema"> 

    <soapenv:Header>
        <wsse:Security soapenv:mustUnderstand="1" 
            xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">

            <wsse:UsernameToken xmlns:wsu="http://schemas.xmlsoap.org/ws/2003/06/utility">
                    <wsse:Username>myUsernameString</wsse:Username>
                    <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">123</wsse:Password>
            </wsse:UsernameToken>
        </wsse:Security>
        </soapenv:Header>

    <soapenv:Body>
        <sch:GetUserDetails idSender="5"/>
    </soapenv:Body>

</soapenv:Envelope>

Mon servlet.xml dans le WS.

<bean name="endpointMapping"
  class="org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping">

  <property name="interceptors">
   <list>
    <ref local="wsSecurityInterceptor" />
   </list>
 </property>


    <bean id="wsSecurityInterceptor"
                        class="org.springframework.ws.soap.security.wss4j.Wss4jSecurityInterceptor">
        <property name="validationActions" value="UsernameToken" />
        <property name="validationCallbackHandler" ref="springSecurityCallbackHandler" />
    </bean>

    <bean id="springSecurityCallbackHandler"
                        class="org.springframework.ws.soap.security.wss4j.callback.SpringPlainTextPasswordValidationCallbackHandler">
        <property name="authenticationManager" ref="authenticationManager"/>
    </bean>

    <bean id="authenticationProvider" class="ws.security.CustomAuthenticationProviderImpl">
            <property name="userCommonService" ref="userCommonService" />
        <security:custom-authentication-provider/>
    </bean>

    <security:authentication-manager alias="authenticationManager" />.

Dans mon Client Java - applicationContext.xml

<bean name="webserviceTemplate" class="org.springframework.ws.client.core.WebServiceTemplate">
        <property name="defaultUri" value="http:/localhost:8080/myws-ws/" />
        <property name="marshaller" ref="marshaller" />
        <property name="unmarshaller" ref="unmarshaller" />
        <property name="interceptors">
            <list>
                <ref local="wsSecurityInterceptor" />
            </list>
        </property>
    </bean>

    <oxm:jaxb2-marshaller id="marshaller"
        contextPath="org.example.bean.schema" />
    <oxm:jaxb2-marshaller id="unmarshaller"
        contextPath="org.example.org.bean.schema" />

    <bean id="client" class="example.client.impl.EfactClientImpl">
        <property name="webServiceTemplate" ref="webserviceTemplate" />
    </bean>

     <bean id="wsSecurityInterceptor" class="org.springframework.ws.soap.security.wss4j.Wss4jSecurityInterceptor">
        <property name="securementActions" value="UsernameToken"/>
    </bean>

Lorsque j'utilise le SAVON d'INTERFACE utilisateur pour utiliser le service tout va bien, je pense que j'ai besoin d'un peu d'aide à la Java du Client et de son contexte, car quand je le lance j'ai ce message d'erreur:

The security token could not be authenticated or authorized; nested exception is: 
    javax.security.auth.callback.UnsupportedCallbackException; nested exception is org.apache.ws.security.WSSecurityException: The security token could not be authenticated or authorized; nested exception is: 
    javax.security.auth.callback.UnsupportedCallbackException

Quand je debug de mon application, j'ai peut remarquer que cet élément est de s'écraser:

GetUserRequest request = new GetUserRequest();
        request.setIdentifier(user.getIdentifier());
        request.setPassword(user.getPassword());
        GetUserResponse response = new GetUserResponse();
/* Crashing here. */
response = (GetUserResponse) getWebServiceTemplate().marshalSendAndReceive(request);

FYI: je vois toujours cette liste d'utilisateurs dans SpringWS avec la sécurité, mais que si j'ai beaucoup d'utilisateurs qui tentent d'accéder.

WS - [servlet-name]-servlet.xml

<bean id="callbackHandler" class="org.springframework.ws.soap.security.wss4j.callback.SimplePasswordValidationCallbackHandler">
    <property name="users">
      <props>
        <prop key="Bert">Ernie</prop>
        <prop key="Mickey">Mouse</prop>
      </props>
    </property>
  </bean>

Comment puis-je résoudre ce UnsupportedCallbackException Exception?

Je ne vois pas question claire.
Je suis désolé, je viens de modifier ma question.

OriginalL'auteur RicardoGonzales | 2012-11-17