我正在使用Karate API自动化3个API(Rest_1,Rest_2和Soap_3服务)。基本上,Rest_1输出将输入到Rest_2,Rest_2输出将输入到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
函数参考后不要留空格:
* 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}
添加以上内容解决了我的问题。谢谢。