[英]Karate API - Getting 500 error while hitting SOAP service in batch
我正在使用空手道 API 自动化 3 个 API(Rest_1、Rest_2 和 Soap_3 服务)。 基本上 Rest_1 output 将输入到 Rest_2 和 Rest_2 output 将输入到 Soap_3。 为每个 API 创建 3 个功能文件和一个调用这 3 个功能的主功能文件。 Rest_1-->Rest_2 流按预期工作,Rest_2-->Soap_3 请求 XML 正在按预期生成,但相同的请求未命中 Soap_3 服务并获得响应 500。
当我单独执行 Soap_3 功能文件时,它给了我预期的响应。 但在批处理中它会抛出 500 错误。
如果我使用 Rest_2-->Soap_3 生成的 XML 并在 SoapUI 中手动运行它,它工作正常。
在这个问题上请求你的帮助。 提前致谢 !
下面是我的 Soap_3 服务功能文件:
Feature: Get PolicyDetails
Background:
* configure headers = {Content-Type: 'application/soap+xml; charset=utf-8'}
* configure logPrettyResponse = true
* configure ssl = true
* configure ssl = 'TLSv1.2'
* header Authorization = call read('classpath:resources/common/basic_auth.js') {username:'test',password:'test'}
* url 'https://soap_3apiurl'
Scenario: get the PolicyInfo
* configure charset = null
# getting submission id from preious feature file output
* call read('classpath:resources/dynamic/previous.feature'){'submissionID':'#(submissionID)'}
* xml req = read ('classpath:resources/common/RetrivePolicyDetails.xml')
* karate.set ('req/soapenv:Envelope/soapenv:Body/ns2:retrieveSubmission/ns2:aRequest/SubmissionID',submissionID)
Given request req
When soap action 'https://soap3apiurl'
Then status 200
And print response
**Console log:**
16:43:30.562 [ForkJoinPool-1-worker-1] DEBUG com.intuit.karate - response time in milliseconds: 58.18
1 < 500
1 < Accept-Encoding:
1 < Authorization: Basic
1 < Cneonction: close
1 < Content-Type: application/soap+xml; charset=UTF-8
1 < Cookie: NSC
1 < Date:
1 < Host: soap3APIurl.com
1 < Set-Cookie:
1 < Transfer-Encoding: chunked
1 < X-Forwarded-For: 10.00.00.1, 10.00.00.20
1 < X-Forwarded-Host:
1 < X-Forwarded-Server:
1 < X-dynaTrace: FW1;10000008;-1100030439;601946;6;-11000009;60194;1
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<soapenv:Fault>
<faultcode xmlns:soap11Env="http://schemas.xmlsoap.org/soap/envelope/">soap11Env:Server</faultcode>
<faultstring>Error while building message</faultstring>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
16:43:30.565 [ForkJoinPool-1-worker-1] ERROR com.intuit.karate - status code was: 500, expected: 200
read
function 参考后不要留空格:
* xml req = read('classpath:resources/common/RetrivePolicyDetails.xml')
这在这里解释: https://github.com/intuit/karate/tree/develop/karate-core#locator-lookup
如果这不是问题,请按照以下流程操作: https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue
* configure headers = {Cookie : null}
添加上面的行解决了我的问题。 谢谢。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.