I have written another post
I believe I have developed a useful tool for logging HTTP Response Header and Bodies.
EDIT in Sept 2021
I have abandoned the Materials library. I won’t maintain it any longer. Please do not use it.
Instead, I newly developed a library named materialstore. Using the materialstore library, I createded a demo project Visual Inspection in Katalon Studio. This sample Katalon Studio project includes a Test Case that
- visiit “https://www.google.com/” and make search with key “takalon”
- take PNG screenshots of web pages, save them into local folder named
<projectDir>/store - take HTML page source of web pages, save them into local folder names
<projectDir>/store - generate a HTML Report in which you can see the screenshots and page sources.
If you can write a test case script that make a respose to webservice, the you should be able to write 2 lines:
String responseText = response.getContentText()
Material m = store.write(jobName, jobTimestamp, FileType.JSON, metadata, responseText)
This will be sufficient to store the JSON response into file.
If you do not like my solution, then a simplest way will be 2 lines of Groovy script:
File f = new File("filename.json")
f.text = response.getResponseText()