Scenario: [1:10]
Sample POST
ms: 842
>>
Background:
4
* url 'https://www.dataaccess.com/webservicesserver/NumberConversion.wso'
0
5
* header Content-Type = 'text/xml; charset=utf-8'
0
6
* def path = karate.properties['user.dir']
1
7
* def file = path + '/src/test/resources/payload/post.xml'
1
8
* def body = read('file:' + file)
256
11
Given request body
0
12
When soap action 'NumberToWords'
581
23:37:51.071 request:
1 > POST https://www.dataaccess.com/webservicesserver/NumberConversion.wso
1 > Content-Type: text/xml; charset=UTF-8
1 > SOAPAction: NumberToWords
1 > Content-Length: 237
1 > Host: www.dataaccess.com
1 > Connection: Keep-Alive
1 > User-Agent: Apache-HttpClient/4.5.13 (Java/1.8.0_382)
1 > Accept-Encoding: gzip,deflate
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<NumberToWords xmlns="http://www.dataaccess.com/webservicesserver/">
<ubiNum>500</ubiNum>
</NumberToWords>
</soap:Body>
</soap:Envelope>
23:37:51.236 response time in milliseconds: 165
1 < 200
1 < Cache-Control: private, max-age=0
1 < Content-Type: text/xml; charset=utf-8
1 < Vary: Accept-Encoding
1 < Server: Server
1 < Web-Service: DataFlex 19.1
1 < X-Powered-By: ASP.NET
1 < Date: Fri, 11 Aug 2023 23:37:51 GMT
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<m:NumberToWordsResponse xmlns:m="http://www.dataaccess.com/webservicesserver/">
<m:NumberToWordsResult>five hundred </m:NumberToWordsResult>
</m:NumberToWordsResponse>
</soap:Body>
</soap:Envelope>
13
Then status 200
0
14
And print response
2
23:37:51.240 [print] <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<m:NumberToWordsResponse xmlns:m="http://www.dataaccess.com/webservicesserver/">
<m:NumberToWordsResult>five hundred</m:NumberToWordsResult>
</m:NumberToWordsResponse>
</soap:Body>
</soap:Envelope>
15
And match response /Envelope/Body/NumberToWordsResponse/NumberToWordsResult == 'five hundred'
1
Scenario: [2:17]
Sample POST after updating xml file content
ms: 860
>>
Background:
4
* url 'https://www.dataaccess.com/webservicesserver/NumberConversion.wso'
0
5
* header Content-Type = 'text/xml; charset=utf-8'
17
6
* def path = karate.properties['user.dir']
1
7
* def file = path + '/src/test/resources/payload/post.xml'
1
8
* def body = read('file:' + file)
267
18
* set body/Envelope/Body/NumberToWords/ubiNum = 300
377
19
Given request body
0
20
When soap action 'NumberToWords'
193
23:37:51.064 request:
1 > POST https://www.dataaccess.com/webservicesserver/NumberConversion.wso
1 > Content-Type: text/xml; charset=UTF-8
1 > SOAPAction: NumberToWords
1 > Content-Length: 237
1 > Host: www.dataaccess.com
1 > Connection: Keep-Alive
1 > User-Agent: Apache-HttpClient/4.5.13 (Java/1.8.0_382)
1 > Accept-Encoding: gzip,deflate
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<NumberToWords xmlns="http://www.dataaccess.com/webservicesserver/">
<ubiNum>300</ubiNum>
</NumberToWords>
</soap:Body>
</soap:Envelope>
23:37:51.227 response time in milliseconds: 163
1 < 200
1 < Cache-Control: private, max-age=0
1 < Content-Type: text/xml; charset=utf-8
1 < Vary: Accept-Encoding
1 < Server: Server
1 < Web-Service: DataFlex 19.1
1 < X-Powered-By: ASP.NET
1 < Date: Fri, 11 Aug 2023 23:37:50 GMT
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<m:NumberToWordsResponse xmlns:m="http://www.dataaccess.com/webservicesserver/">
<m:NumberToWordsResult>three hundred </m:NumberToWordsResult>
</m:NumberToWordsResponse>
</soap:Body>
</soap:Envelope>
21
Then status 200
0
22
And print response
3
23:37:51.232 [print] <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<m:NumberToWordsResponse xmlns:m="http://www.dataaccess.com/webservicesserver/">
<m:NumberToWordsResult>three hundred</m:NumberToWordsResult>
</m:NumberToWordsResponse>
</soap:Body>
</soap:Envelope>
23
And match response /Envelope/Body/NumberToWordsResponse/NumberToWordsResult == 'three hundred'
2