The below program reads the XML file and compress into gzip.
I have a couple of questions here.
Can I use the following program directly in JMeter BeanShell pre-processor?
I want to use the output variable as input to JSON request. Is it possible in Jmeter?
Screen shot and details will be appreciated.
public static void main(String[] args) throws Exception {
String line = null; String sb = ""; File f=new File("D:\\RetailTransactionLog_9419_001_590.xml"); FileReader fr=new FileReader(f); BufferedReader br=new BufferedReader(fr); while((line=br.readLine())!=null) { sb= sb + line; } br.close(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); GZIPOutputStream gzos = new GZIPOutputStream(baos); gzos.write(sb.getBytes("UTF-8")); gzos.close(); String base64CompressedString = Base64.getEncoder().encodeToString(baos.toByteArray()); System.out.println(base64CompressedString);


