【发布时间】:2014-04-07 05:48:48
【问题描述】:
我在soapUI 中使用休息请求。 我想将 JSON 请求和响应保存到文件中。 我该怎么做?
【问题讨论】:
我在soapUI 中使用休息请求。 我想将 JSON 请求和响应保存到文件中。 我该怎么做?
【问题讨论】:
报告中不包含请求负载 (JSON)。报告中仅捕获请求 HTTP 标头。如果您能够记录请求 JSON,请告诉我。我正在使用 SoapUI 5.0.0
【讨论】:
右键单击您的 testSuite 并选择 Launch TestRunner,在 Launch TestRunner 面板上选择 Reports 选项卡,在此选项卡上选中 Exports all results,并选择一个根文件夹以将此结果保存到 根文件夹:。最后点击启动。
然后在每个请求的根文件夹中,您将有一个类似 TestSuiteName-TestCaseName-TestStepName-nIteration-result.txt 的文件,其内容如下:
Status: OK
Time Taken: 409
Size: 793
Timestamp: Mon Apr 07 12:47:02 CEST 2014
TestStep: Test Request
----------------- Messages ------------------------------
----------------- Properties ------------------------------
Encoding: UTF-8
Endpoint: http://myHost.com/service/service
---------------- Request ---------------------------
Request Headers: Host : XX.XXX.X.XX
Content-Length : 321
SOAPAction : "http://myAction.com"
Accept-Encoding : gzip,deflate
User-Agent : Apache-HttpClient/4.1.1 (java 1.5)
Connection : Keep-Alive
Content-Type : text/xml;charset=UTF-8
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
<element/>
<element/>
</soapenv:Header>
<soapenv:Body>
...
</soapenv:Body>
</soapenv:Envelope>
---------------- Response --------------------------
Response Headers: Date : Mon, 07 Apr 2014 10:48:34 GMT
#status# : HTTP/1.1 200
Content-Length : 793
Expires : Thu, 01 Jan 1970 00:00:00 GMT
Content-Type : text/xml; charset=UTF-8
Connection : close
Server : XXXXXXXXXXXX
Cache-Control : no-cache
Pragma : no-cache
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
...
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
如果您希望只保存请求和响应而不需要其他信息,您可以查看 this 和 this。
希望这会有所帮助,
【讨论】: