I have an export service which returns a compressed xml, and I save it in a zip file. An import service receives the content of the file and changes the database accordingly.
I am trying to write a simple test suite in JMeter (export and then import) and I got stuck at the following: how to take the compressed xml from the response of the export service and to pass it in the request of the import service? Is this possible in JMeter? I googled it, but couldn't find anything useful.
There are at least 3 ways of doing this:
Regular Expression Extractor PostProcessor. If you not too familiar with regex, the following one will return the whole response body
(?s)(^.*)
Using Beanshell PostProcessor. Only one line of code is required to store the whole response into "response" JMeter Variable.
vars.put("response", new String(data));
It is possible to store response into a file via Save Responses to a file listener from the export service and passing the file to the import service. See Performance testing: Upload and Download Scenarios with Apache JMeter guide for details on how to properly do this as there are some nuances.