applicationContext-cxf-client.xml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3. xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:cxf="http://cxf.apache.org/core"
  4. xsi:schemaLocation="http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"
  5. default-lazy-init="true">
  6. <description>Apache CXF Web Service Client端配置</description>
  7. <import resource="classpath:META-INF/cxf/cxf.xml" />
  8. <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
  9. <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
  10. <!-- 使用WS-Security中的明文密码认证机制的客户端 -->
  11. <jaxws:client id="userServiceWithPlainPassword" serviceClass="com.pentair.showcase.ws.server.UserWebService"
  12. address="http://localhost:8080/showcase/services/UserServiceWithPlainPassword">
  13. <jaxws:outInterceptors>
  14. <bean class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor">
  15. <property name="properties">
  16. <map>
  17. <entry key="action" value="UsernameToken" />
  18. <entry key="user" value="admin" />
  19. <entry key="passwordType" value="PasswordText" />
  20. <entry key="passwordCallbackRef" value-ref="passwordCallback" />
  21. </map>
  22. </property>
  23. </bean>
  24. </jaxws:outInterceptors>
  25. </jaxws:client>
  26. <!-- 使用WS-Security中的Digest密码认证机制的客户端, 不使用本XML直接在代码中直接定义. -->
  27. <!-- 使用WS-Security中的明文密码认证机制访问与SpringSecurity权限管理结合EndPoint的客户端 -->
  28. <jaxws:client id="userServiceWithSpringSecurity" serviceClass="com.pentair.showcase.ws.server.UserWebService"
  29. address="http://localhost:8080/showcase/services/UserServiceWithSpringSecurity">
  30. <jaxws:outInterceptors>
  31. <bean class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor">
  32. <property name="properties">
  33. <map>
  34. <entry key="action" value="UsernameToken" />
  35. <entry key="user" value="admin" />
  36. <entry key="passwordType" value="PasswordText" />
  37. <entry key="passwordCallbackRef" value-ref="passwordCallback" />
  38. </map>
  39. </property>
  40. </bean>
  41. </jaxws:outInterceptors>
  42. </jaxws:client>
  43. <!-- 客户端密码配置Bean定义 -->
  44. <bean id="passwordCallback" class="com.pentair.showcase.ws.client.PasswordCallback" />
  45. </beans>