gpt4 book ai didi

soap - spring-ws 2.2.1 中的无效属性 'securementCallbackHandlers'

转载 作者:行者123 更新时间:2023-12-04 18:43:22 24 4
gpt4 key购买 nike

我使用 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服务)可以帮我吗?

最佳答案

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

Javadoc for Wss4JSecurityInterceptor

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

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

关于soap - spring-ws 2.2.1 中的无效属性 'securementCallbackHandlers',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31669331/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com