Hi,
i have a GET request that returns a document with guid mentioned in fileGuid in URL: ${baseurl}/api/file/download/${fileGuid}
Test Case:
response = WS.sendRequest(findTestObject(’***))
String doccontent = response.getResponseText()
Thsi returns the document content along with binary content as below:
¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ $P B �: WORKSHEET
please note that the document downloaded is a word document with headers and footers in tabulated format. Do suggest how to retrieve this response in the correct format of word document and save in a folder as evidence.
You are aware that the resposonse contains a byte array (binary content).
But the following statement:
process the response as if it contains a plain text, which is not true. Therefore the statement does not work.
If I were you, I would write the content of the HTTP response into a local file. I would named the file with filename extension .docx, as you know the HTTP response is a Microsoft Word document. Once you got the Word file saved locally, you can open it with Microsoft Word app.
I would not recommend you to try to manipulate a word document with Java/Groovy=KatalonStudio. It’s too hard and too boring.
Once I tried to use Katalon’s WS.sendRequest() and RequestObject, and found these can not deal with any binary files appropriately. It seems that Katalon’s WS API thinks every HttpBodyContent is String.
hi,
i attempted to donwload this content to .doc file and it failed to contain the tabulated grid like content as in source file. The downloaded doc file still contain the binary content in them
Hard to understand but I guess that @AVS wants Katalon Studio to intelligently parse a downloaded .docx file, extract a “tabulated grid” out of the .docx, and render it in Katalon Studio GUI in a “non binary” human-readable format. Very complex requirement.