【问题标题】:How to set up stubby db for SOAP services如何为 SOAP 服务设置 stubby db
【发布时间】:2016-07-29 06:46:45
【问题描述】:

我正在尝试存根 SOAP 服务。我发现stubby4j 和 stubby-db 都可以存根 SOAP 服务。但是给出的所有示例都是针对 RESTful 服务的。

如何存根 SOAP 服务?

使用特定的有什么好处吗?我必须同时存根 SOAP 和 REST 服务。他们可以在单个回购中存根吗?还是我需要创建 2 个单独的存根存储库或 2 个单独的映射文件?

【问题讨论】:

  • 谢谢@Rao。但我觉得你的代码可以用来编写存根服务器。但它不像上面2个工具?
  • 我还为这个here添加了一个详细的例子

标签: rest soap stubby4j stubbydb


【解决方案1】:

stubby4j 和 stubby-db 都可用于存根 HTTP(s) 调用。您可以将 SOAP 服务视为带有 XML 负载的 POST HTTP 调用。

你应该使用 StubbyDB 还是 Stubby4j,这完全取决于你的需要。

您无需拆分为 2 个项目。您仍然可以在单个存储库中同时进行两个存根调用。但是,如果您使用 stubby4j,则不能将映射拆分为两个文件。您可以使用 stubby-db 拥有任意数量的映射文件。

编辑

肥皂

-  request:
      method: POST
      url: /soap-simulator/services/ServiceName
      post: actionName[\s\S]*mobile.([0-9]+)

   response:
      status: 200
      latency: 0
      headers:
            content-type: text/xml
      strategy: "first-found"
      files: ["stubs/<% post.1 %>/response.xml","stubs/ServiceName/actionName/default.xml"]

休息

-  request:
      method: POST
      url: /soap-simulator/services/ServiceName/actionName
      post: mobile.([0-9]+)

   response:
      status: 200
      latency: 0
      headers:
            content-type: text/xml
      strategy: "first-found"
      files: ["stubs/<% post.1 %>/response.xml","stubs/ServiceName/actionName/default.xml"]

【讨论】:

  • 你能给我举个例子吗?
  • 我已经用 stubby-db 中的示例映射更新了我的答案
  • 抱歉这么晚才回复:但是,在 stubby4j 中,可以将主 YAML 配置拆分为多个 YAML 子配置,以便更好地组织存根代码。请看stubby4j.com/docs/…
猜你喜欢
  • 1970-01-01
  • 2018-07-22
  • 2011-12-30
  • 1970-01-01
  • 2019-04-15
  • 2019-04-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多