Scenario: [1:10]
Sample POST
ms: 1204
>>
Background:
4
* url 'https://www.dataaccess.com/webservicesserver/NumberConversion.wso'
1
5
* header Content-Type = 'text/xml; charset=utf-8'
2
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)
129
11
Given request body
0
12
When soap action 'NumberToWords'
1057
23:55:09.335 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:55:09.657 response time in milliseconds: 322
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:55:09 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
6
23:55:09.669 [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'
7
Scenario: [2:17]
Sample POST after updating xml file content
ms: 1199
>>
Background:
4
* url 'https://www.dataaccess.com/webservicesserver/NumberConversion.wso'
21
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)
108
18
* set body/Envelope/Body/NumberToWords/ubiNum = 300
492
19
Given request body
2
20
When soap action 'NumberToWords'
568
23:55:09.333 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:55:09.666 response time in milliseconds: 333
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:55:09 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
5
23:55:09.672 [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