bpe*_*lur 9 spring soap spring-ws soapui soap-client
我有肥皂请求发送到该服务.在发送之前我想编辑Soap标头
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" soapenv:mustUnderstand="1">
Run Code Online (Sandbox Code Playgroud)
这是我希望传递值为mustUnderstand0而不是1 的标题之一.因为我将值传递为1时会出现一个异常.我得到的值为1的异常是:
org.springframework.ws.soap.client.SoapFaultClientException: One or more mandatory SOAP header blocks not understood
Run Code Online (Sandbox Code Playgroud)
我已经通过将mustUnderstand值传递为0来检查Soap UI 并且它有效.现在我想从我的客户端发送同样的东西.
我试图在应用程序conext bean定义xml文件中添加参数,但没有按照下面的方法工作
<property name="securementmustUnderstand"><value>false</value></property>
Run Code Online (Sandbox Code Playgroud)
请让我知道如何mustUnderstand在我的客户端更改参数.
完整的bean定义如下:
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean id="reg" class="com.service.RegConsServiceImpl">
<property name="regWebServiceTemplate" ref="regWebServiceTemplate"/>
</bean>
<bean id="regWebServiceTemplate" class="org.springframework.ws.client.core.WebServiceTemplate">
<constructor-arg ref="messageFactory"/>
<property name="marshaller" ref="marshaller"/>
<property name="unmarshaller" ref="unmarshaller"/>
<property name="interceptors">
<list>
<ref bean="wsRegClientSecurityInterceptor"/>
</list>
</property>
</bean>
<bean id="wsRegClientSecurityInterceptor" class="org.springframework.ws.soap.security.wss4j.Wss4jSecurityInterceptor">
<property name="securementmustUnderstand">
<value>false</value>
</property>
<property name="securementActions" value="UsernameToken" />
<property name="securementPasswordType" value="PasswordText"/>
<property name="securementPassword">
<value>${registration.ws.password}</value>
</property>
<property name="securementUsername">
<value>${registration.ws.username}</value>
</property>
</bean>
</beans>
Run Code Online (Sandbox Code Playgroud)
以下是生成的soap消息
<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" soapenv:mustUnderstand="1">
<wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="UsernameToken-3">
<wsse:Username>test</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">test</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<ns3:GetRegInfo xmlns:ns3="http://www.test.com/regester" xmlns:ns2="http://www.test.com/regester2" xmlns:ns4="http://com.test.com.services.register">
<ns3:personId>10</ns3:personId>
</ns3:GetRegInfo>
</soapenv:Body>
</soapenv:Envelope>
Run Code Online (Sandbox Code Playgroud)