【问题标题】:Citrus-Framework: Possible to send SOAP attachment from server simulation with Java DSL?Citrus-Framework:可以使用 Java DSL 从服务器模拟发送 SOAP 附件吗?
【发布时间】:2018-01-15 14:04:53
【问题描述】:

对于使用 Citrus Framework 的组件测试,我模拟一个通过 SOAP 调用的后端系统

<citrus-ws:server id="backendSimulationServer"
                port="8080"
                auto-start="true"
                interceptors="serverInterceptors"
                timeout="5000"/>

我从组件获取 SOAP 请求并发回响应。

    runner.receive(action -> action.endpoint("backendSimulationServer")
            .name("search-request")
            .payload(new ClassPathResource("testfiles/search-request-expectation.xml"))
    );

    runner.send(action -> action.endpoint("backendSimulationServer")
            .name("search-response")
            .payload(new ClassPathResource("testfiles/search-response.xml"))
    );

但现在我必须使用 MTOM 附件响应来回答请求。我找到了在soap().client() 上使用.attachment 的柑橘类示例,但是对于我的服务器模拟,.attachment 不可用

这可以通过 Java DSL 实现吗?还是我要在 XML DSL 中重写测试用例来实现这一点?

【问题讨论】:

    标签: simulation mtom citrus-framework


    【解决方案1】:

    在 Citrus 的服务器组件上也可以使用 SOAP 附件和启用 MTOM 的方法。这应该可以为您解决问题:

    soap().server(soapMtomServer)
          .send()
          .mtomEnabled(true)
          .attachment("IMAGE", "application/octet-stream", new ClassPathResource("com/consol/citrus/hugeImageData.png"))
          .payload("<image:addImage xmlns:image=\"http://www.citrusframework.org/imageService/\">" +
                       "<image>cid:IMAGE</image>" +
                   "</image:addImage>");
    

    【讨论】:

      猜你喜欢
      • 2018-06-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-07-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多