我可能会使用具有以下要求的 CXF 框架来实现 Web 服务:
- 用户名令牌
- AES 加密
系统可能会在调用它之前将密钥传递给 WS。我尝试按以下方式进行配置,但不起作用。
<bean id="logInBound" class="org.apache.cxf.interceptor.LoggingInInterceptor" />
<bean id="logOutBound" class="org.apache.cxf.interceptor.LoggingOutInterceptor" />
<jaxws:client id="helloClient" serviceClass="com.itiboss.facade.HelloWorld" address="http://localhost:18080/spring-jpa/ws/HelloWorld">
<jaxws:properties>
<entry key="mtom-enabled" value="true"/>
</jaxws:properties>
<jaxws:inInterceptors>
<ref bean="logInBound" />
</jaxws:inInterceptors>
<jaxws:outInterceptors>
<ref bean="logOutBound" />
<ref bean="outbound-security" />
</jaxws:outInterceptors>
</jaxws:client>
<!-- WSS4JOutInterceptor for incorporating a UsernameToken in a SOAP -->
<bean class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor" id="outbound-security">
<constructor-arg>
<map>
<entry key="action" value="UsernameToken Encrypt"/>
<entry key="user" value="dummy"/>
<entry key="allowMTOM" value="true"/>
<entry key="encryptionSymAlgorithm" value="http://www.w3.org/2001/04/xmlenc#aes256-cbc"/>
<!--entry key="passwordType" value="PasswordText"/-->
<entry key="passwordCallbackClass" value="com.itiboss.facade.ClientPasswordCallback"/>
</map>
</constructor-arg>
</bean>