Soapui - 保存JSON请求和响应

时间:2014-04-07 05:48:48

标签: json rest soapui

我正在使用soapUI中的rest请求。 我想将JSON请求和响应保存到文件中。 我该怎么办?

2 个答案:

答案 0 :(得分:1)

请求有效负载(JSON)未包含在报告中。仅在报告中捕获请求HTTP标头。如果您能够记录请求JSON,请告诉我。我正在使用SoapUI 5.0.0

答案 1 :(得分:0)

右键单击testSuite并选择启动TestRunner ,在Launch TestRunner面板上选择报告选项卡,在此选项卡上选中导出所有结果,并选择一个根文件夹将此结果保存在根文件夹:。最后点击启动

然后在每个请求的根文件夹中,您将获得一个文件,如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>

如果您希望仅保存请求和响应而不提供其他信息,可以查看thisthis

希望这有帮助,