Invalid property "securementCallbackHandlers" in spring-ws 2.2.1

I am creating a webservice using spring-ws (Soap) and now I want to create an encryption webservice. my 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"/>

      

but i have e this error:

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

      

I got help from Spring Web Services 2 Cookbook. but this book uses Spring 1.5 web service, but I am using Spring 2.2.1 web service, (create a web service in Spring Boot 1.2.5 server side web service) Can any help me?

+3


source to share


1 answer


I faced the same error. Basically this property was removed sometime after 2.0.3 from Spring WS when they decided to migrate to Apache WSS4J 1.6 and they couldn't figure out how to create a callback handler in Securement actions. So they basically just removed it without warning or explanation and without updating their documentation.

Javadoc for Wss4JSecurityInterceptor



Typical movement by Spring people. Here is an issue in their JIRA tracker where they refer to this as "Feature Enhancement" for 2.3.

Fortunately, however, someone out there has spotted a potential workaround until that happens. It creates its own Securement callback handler class and its own Wss4JSecurityInterceptor class that adds this property. It's worth exploring.

+1


source







All Articles