空手道 0.9.1 正在为 soap webservice 测试抛出异常

Karate 0.9.1 is throwing exceptions for soap webservice testing

我正在尝试使用 Karate 0.9.1 测试 soap 网络服务,我根据文档创建了场景。

但是我在测试场景中传递 web 服务请求时测试 soap web 服务时出现异常。

场景:1 我通过了如下请求,

* def req=
""" 
  <?xml version='1.0' encoding='UTF-8'?>
  <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
  <S:Body>
  <ns2:QueryUsageBalance xmlns:ns2="http://www.mycompany.com/usage/V1">
      <ns2:UsageBalance>
          <ns2:LicenseId>12341234</ns2:LicenseId>
      </ns2:UsageBalance>
  </ns2:QueryUsageBalance>
  </S:Body>
  </S:Envelope>
  """

结果

“[Fatal Error] :32:18: XML document structures must start and end within the same entity”

场景:2

Given request
""" 
  <?xml version='1.0' encoding='UTF-8'?>
  <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
  <S:Body>
  <ns2:QueryUsageBalance xmlns:ns2="http://www.mycompany.com/usage/V1">
      <ns2:UsageBalance>
          <ns2:LicenseId>12341234</ns2:LicenseId>
      </ns2:UsageBalance>
  </ns2:QueryUsageBalance>
  </S:Body>
  </S:Envelope>
  """

结果

“[Fatal Error] :32:18: XML document structures must start and end within the same entity”

场景:3

Given request =
""" 
  <?xml version='1.0' encoding='UTF-8'?>
  <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
  <S:Body>
  <ns2:QueryUsageBalance xmlns:ns2="http://www.mycompany.com/usage/V1">
      <ns2:UsageBalance>
          <ns2:LicenseId>12341234</ns2:LicenseId>
      </ns2:UsageBalance>
  </ns2:QueryUsageBalance>
  </S:Body>
  </S:Envelope>
  """

结果

Program execution freezes and no output

任何人都可以帮助我理解我在这里做错了什么。

我在空手道 0.6.1 中使用了相同的 xml,它工作正常。

只需将三引号放在单独的一行上就可以了:

* def req =
"""
<?xml version='1.0' encoding='UTF-8'?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:QueryUsageBalance xmlns:ns2="http://www.mycompany.com/usage/V1">    <ns2:UsageBalance>
<ns2:LicenseId>12341234</ns2:LicenseId>
</ns2:UsageBalance>
</ns2:QueryUsageBalance>
</S:Body>
</S:Envelope>
"""
* print req

我们曾要求用户测试 Beta 版本,但您似乎还没有看到它们:https://twitter.com/KarateDSL/status/1064375506202755073

无论如何,如果您仍然遇到类似 "freezes" 的问题,请按照以下流程操作:https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue