如何在 SOAP header 请求中发送纯用户名和密码?
How to send the plain username and password in SOAP header request?
如何在 SOAP header 请求中发送纯用户名和密码?
当前配置如下:
<bean id="webServiceTemplate" class="org.springframework.ws.client.core.WebServiceTemplate">
<property name="marshaller" ref="jaxb2Marshaller"></property>
<property name="unmarshaller" ref="jaxb2Marshaller"></property>
<property name="defaultUri"><value>${ws.url}</value></property>
<property name="interceptors">
<list>
<ref local="wsClientSecurityInterceptor"/>
</list>
</property>
</bean>
...
<bean id="wsClientSecurityInterceptor"
class="org.springframework.ws.soap.security.wss4j.Wss4jSecurityInterceptor">
<property name="securementActions" value="UsernameToken" />
<property name="securementUsername"><value>${exacttarget.ws.username}</value></property>
<property name="securementPassword"><value>${exacttarget.ws.password}</value></property>
</bean>
但是生成的密码如下:
<SOAP-ENV:Header>
<wsse:Security
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" SOAP-ENV:mustUnderstand="1">
<wsse:UsernameToken wsu:Id="UsernameToken-0D2A3753C819EC67F714950869115581">
<wsse:Username>testuser</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">1234435erwerwerwerwe=</wsse:Password>
<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">YJTk+IJ8jIKJSFrDT7Y0mw==</wsse:Nonce>
<wsu:Created>2017-05-18T05:55:11.557Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
</SOAP-ENV:Header>
我应该在我的配置中更改什么以使密码显示在 PLAIN 中?
再添加一个 属性 "securementPasswordType" 帮助我实现了它。
<bean id="wsClientSecurityInterceptor"
class="org.springframework.ws.soap.security.wss4j.Wss4jSecurityInterceptor">
<property name="securementActions" value="UsernameToken" />
<property name="securementUsername"><value>AAAA</value></property>
<property name="securementPassword"><value>BBBB</value></property>
<property name="securementPasswordType" value="PasswordText" />
</bean>
如何在 SOAP header 请求中发送纯用户名和密码?
当前配置如下:
<bean id="webServiceTemplate" class="org.springframework.ws.client.core.WebServiceTemplate">
<property name="marshaller" ref="jaxb2Marshaller"></property>
<property name="unmarshaller" ref="jaxb2Marshaller"></property>
<property name="defaultUri"><value>${ws.url}</value></property>
<property name="interceptors">
<list>
<ref local="wsClientSecurityInterceptor"/>
</list>
</property>
</bean>
...
<bean id="wsClientSecurityInterceptor"
class="org.springframework.ws.soap.security.wss4j.Wss4jSecurityInterceptor">
<property name="securementActions" value="UsernameToken" />
<property name="securementUsername"><value>${exacttarget.ws.username}</value></property>
<property name="securementPassword"><value>${exacttarget.ws.password}</value></property>
</bean>
但是生成的密码如下:
<SOAP-ENV:Header>
<wsse:Security
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" SOAP-ENV:mustUnderstand="1">
<wsse:UsernameToken wsu:Id="UsernameToken-0D2A3753C819EC67F714950869115581">
<wsse:Username>testuser</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">1234435erwerwerwerwe=</wsse:Password>
<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">YJTk+IJ8jIKJSFrDT7Y0mw==</wsse:Nonce>
<wsu:Created>2017-05-18T05:55:11.557Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
</SOAP-ENV:Header>
我应该在我的配置中更改什么以使密码显示在 PLAIN 中?
再添加一个 属性 "securementPasswordType" 帮助我实现了它。
<bean id="wsClientSecurityInterceptor"
class="org.springframework.ws.soap.security.wss4j.Wss4jSecurityInterceptor">
<property name="securementActions" value="UsernameToken" />
<property name="securementUsername"><value>AAAA</value></property>
<property name="securementPassword"><value>BBBB</value></property>
<property name="securementPasswordType" value="PasswordText" />
</bean>