how to get the zip file after running HTTP request.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
how to get the zip file after running HTTP request.
Hi,
The http request is about exporting application to local path.
I run the HTTP request in postman and click "Send and Download" button, and can save the exported zip file into local path.
Then I run this HTTP request in soapui 5.0.0, cannot get exported zip file as Postman. From body of response, server return data in responce, please see the attached "body of response.txt" file. Does anyone know how to get file as .zip?
Best regards,
Bessie
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
By the way, do you get any attachments in the response of HttpRequest step?
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks a lot for your reply. Do you also want to see the screenshot of raw data of response? If yes, please see the attached "raw of response.jpg" file.
No attchement in response of HttpRequest. Plase see attached "xml of response.jpg" file.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
So, you may need to extract the response content and save it as zip file using groovy script.
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, do you know how to extract the response content and save it as zip file? Would you please share code with me? Thanks again.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
https://community.smartbear.com/t5/SoapUI-Open-Source/Saving-attachments-automatically/td-p/880
What you need to changes is that extract the content from response using xpath then provide it to save into the file.
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Now after running changed scripts, .zip file is created. However, cannot open it, please see attached picture. Would you please see which script line I missed? Thanks.
def responseBody=testRunner.testCase.getTestStepByName("ExportApplication").httpRequest.response.responseContent; //InputStream ins = new ByteArrayInputStream(responseBody.getBytes("UTF-8")) InputStream ins = new ByteArrayInputStream(responseBody.getBytes()) log.info responseBody def outFile = new FileOutputStream(new File('C:/temp'+'/TestCreateDeleteApp_1.0.zip')) if (ins) { com.eviware.soapui.support.Tools.writeAll(outFile, ins ) } ins.close() outFile.close()
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi All,
I used the script from the previous answer and was able to save a zip. When I open the zip and try to open the xml inside I get a Data error 'file is broken'.
What am I doing wrong?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@jurven007: This post is over a year old. You may be better served writing your own post with your own specific details, and reference this thread as/if necessary.
---
Click the Accept as Solution button if my answer has helped, and remember to give kudos where appropriate too!
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks, I will open a new request
