【问题标题】:Invalid property 'securementCallbackHandlers' in spring-ws 2.2.1spring-ws 2.2.1 中的无效属性“securementCallbackHandlers”
【发布时间】:2015-07-28 06:56:58
【问题描述】:

我用 spring-ws (Soap) 创建 Web 服务 现在,我想创建加密网络服务。 我的 applicationContext.xml 是:

<?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"/>

但是,我有这个错误:

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 的帮助。 但是本书使用的是spring web service 1.5,但我使用的是spring web service 2.2.1,(我在服务器端的spring boot web service 1.2.5中创建web service) 可以帮帮我吗?

【问题讨论】:

    标签: soap spring-ws encryption-symmetric wss4j


    【解决方案1】:

    我遇到了同样的错误。本质上,这个属性在 Spring WS 2.0.3 之后的某个时候被删除,当时他们决定升级到 Apache WSS4J 1.6,他们无法弄清楚如何在安全操作上创建回调处理程序。所以他们基本上只是删除了它,没有警告或解释,也没有更新他们的文档。

    Javadoc for Wss4JSecurityInterceptor

    Spring 人的典型举动。 Here is an issue in their JIRA tracker 他们将其标记为 2.3 的“功能改进”。

    幸运的是,在这种情况发生之前,有人发布了一个潜在的解决方法。他正在创建自己的安全回调处理程序类和添加此属性的自定义 Wss4JSecurityInterceptor 类。值得研究。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-01-23
      • 2019-12-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多