【问题标题】:Testing CXF Client with Spring WS Test使用 Spring WS Test 测试 CXF 客户端
【发布时间】:2014-12-01 11:02:43
【问题描述】:

根据文档,您可以使用http://docs.spring.io/spring-ws/site/apidocs/org/springframework/ws/test/client/MockWebServiceServer.html 服务器很好地测试您的WS 客户端。

但是您的客户必须满足一个先决条件

   // MyWebServiceClient extends WebServiceGatewaySupport, and is configured in applicationContext.xml
   @Autowired
   private MyWebServiceClient client;

扩展 WebServiceGatewaySupport。

我的问题是如果我使用另一个实现,例如 CXF。是否有任何支持 CXF 客户端的现有模拟服务器实现?

【问题讨论】:

    标签: java web-services cxf spring-ws


    【解决方案1】:

    没有。 spring-ws-test 模块是 Spring-WS 特有的,不能与其他框架一起使用。例如,您可以为此使用 SoapUI。

    【讨论】:

    • 我可以在没有soapui 的情况下使用我自己的“模拟”jaxws:server 实例进行测试。虽然拥有像 WebServiceGatewaySupport 这样的 Spring-WS 测试模拟之类的东西会很棒。
    【解决方案2】:

    我创建了一个simple JUnit rule,它可以让您在 CXF 中使用服务器进行模拟。基本上使用属性配置您的客户端,然后将它们指向一个委托给模拟对象的 Web 服务实例。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-01-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多