2015-07-28 7 views
3

Я создаю веб-сервис с помощью Spring-ws (Soap) и теперь хочу создать веб-сервис шифрования. мой applicationContext.xml является:Неверное свойство «securementCallbackHandlers» в spring-ws 2.2.1

<?xml version="1.0" encoding="UTF-8"?> 
<beans xmlns="http://www.springframework.org/schema/beans" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:web-services="http://www.springframework.org/schema/web-services" 
xsi:schemaLocation="http://www.springframework.org/schema/web-services http://www.springframework.org/schema/web-services/web-services.xsd 
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> 

<bean id="webserviceTemplate" 
     class="org.springframework.ws.client.core.WebServiceTemplate"> 
    <constructor-arg ref="messageFactory" /> 
    <property name="defaultUri" value="http://localhost:8081/surena/signauthenticateservice/"/> 
    <property name="interceptors"> 
     <bean class="org.springframework.ws.soap.security.wss4j.Wss4jSecurityInterceptor"> 
      <property name="securementActions" value="Encrypt"/> 
      <property name="securementEncryptionKeyIdentifier" value="EmbeddedKeyName"/> 
      <property name="securementEncryptionUser" value="symmetric"/> 
      <property name="securementEncryptionEmbeddedKeyName" value="symmetric"/> 
      <property name="SecurementEncryptionSymAlgorithm" value="http://www.w3.org/2001/04/xmlenc#tripledes-cbc"/> 

      <property name="securementCallbackHandlers"> 
       <bean class="org.springframework.ws.soap.security.wss4j.callback.KeyStoreCallbackHandler"> 
        <property name="symmetricKeyPassword" value="keyPassword"/> 
        <property name="keyStore"> 
         <bean class="org.springframework.ws.soap.security.support.KeyStoreFactoryBean"> 
          <property name="location" value="/symmetricStore.jks"/> 
          <property name="type" value="JCEKS"/> 
          <property name="password" value="symmetricPassword"/> 
         </bean> 
        </property> 
       </bean> 
      </property> 
     </bean> 
    </property> 
</bean> 
<bean id="log4jInitialization" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"> 
    <property name="targetClass" value="org.springframework.util.Log4jConfigurer" /> 
    <property name="targetMethod" value="initLogging" /> 
    <property name="arguments"> 
     <list> 
      <value>src/test/resources/log4j.properties</value> 
     </list> 
    </property> 
</bean> 
<bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory"/> 

, но я есть E эту ошибку:

Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'securementCallbackHandlers' of bean class [org.springframework.ws.soap.security.wss4j.Wss4jSecurityInterceptor]: Bean property 'securementCallbackHandlers' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? 
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:1076) 
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:927) 
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:95) 
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:75) 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1510) 
... 50 more 

я получил помощь Spring Web Services 2 Cookbook. , но эта книга использует весенний веб-сервис 1.5, но я использую Spring web service 2.2.1, (я создаю веб-сервис в веб-службе весной загрузки 1.2.5 на стороне сервера) Может мне помочь?

ответ

1

Я столкнулся с той же ошибкой. По сути, это свойство было удалено когда-то после 2.0.3 Spring WS, когда они решили перейти на Apache WSS4J 1.6, и они не могли понять, как создать обработчик обратного вызова в действиях Securement. Поэтому они в основном просто удалили его без предупреждения или объяснения и без обновления своей документации.

Javadoc for Wss4JSecurityInterceptor

Типичный шаг весенних людей. Here is an issue in their JIRA tracker, где они обозначают это как «Улучшение функций» для 2.3.

К счастью, кто-то там обнаружил потенциальное обходное решение, пока это не произойдет. Он создает свой собственный класс обработчиков обратного вызова Securement и свой собственный класс Wss4JSecurityInterceptor, который добавляет это свойство. Это стоит посмотреть.

 Смежные вопросы

  • Нет связанных вопросов^_^