简体   繁体   English

如何为 SOAP 服务设置 stubby db

[英]How to set up stubby db for SOAP services

I am trying to stub SOAP services.我正在尝试存根 SOAP 服务。 I found that stubby4j and stubby-db both can stub SOAP services.我发现stubby4j和 stubby-db 都可以存根 SOAP 服务。 But all the examples given are for RESTful services.但是给出的所有示例都是针对 RESTful 服务的。

How to stub SOAP services?如何存根 SOAP 服务?

Is there any advantage to use particular one?使用特定的有什么好处吗? I have to stub SOAP & REST services both.我必须同时存根 SOAP 和 REST 服务。 Can they be stubbed in single repo?它们可以在单个回购中存根吗? Or do I need to create 2 separate stub repos or 2 separate mapping files?还是我需要创建 2 个单独的存根存储库或 2 个单独的映射文件?

stubby4j and stubby-db both can be used to stub HTTP(s) calls. stubby4j 和stubby-db都可用于存根 HTTP(s) 调用。 You can consider SOAP services as POST HTTP call with XML payload.您可以将 SOAP 服务视为带有 XML 负载的 POST HTTP 调用。

Whether you should use StubbyDB or Stubby4j, it completely depends on your need.您应该使用 StubbyDB 还是 Stubby4j,这完全取决于您的需要。

You need not to split into 2 projects.您无需拆分为 2 个项目。 You can still have both stub calls in single repository.您仍然可以在单个存储库中进行两个存根调用。 However if you go with stubby4j, you can't split mappings in two files.但是,如果您使用 stubby4j,则无法将映射拆分为两个文件。 You can have any number of mapping files with stubby-db.您可以使用 stubby-db 拥有任意数量的映射文件。

Edit编辑

SOAP肥皂

-  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"]

REST休息

-  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"]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM