title: SOAP UI - Save HTTP request to a GZIP file
body: <p>I m using Soap UI free version for some rest mocking.   </p>
  
  <p>I need to persist my HTTP POST request (request received already compressed gzip) to a gzip file.<br>
  I have tried different ways to do that,  however after to execute the code, when I try to decompress manually the file I have the following error: "The archive is either in unknown format or damaged".  </p>
  
  <p>The HTTP POST request has the following header:  </p>
  
  <pre><code>Host : 127.0.0.1:8091
  Content-Length : 636
  User-Agent : Java/1.7.0_07
  Connection : keep-alive
  Content-Type : application/octet-stream
  Accept : text/plain, application/json, application/*+json, */*
  Pragma : no-cache
  Cache-Control : no-cache
  </code></pre>
  
  <p>Below the solutions that I have tried:</p>
  
  <p>Solution#1:</p>
  
  <pre><code>byte[] buffer = new byte[1024];  
  byte[] data = mockRequest.getRequestContent().getBytes();  
  def path="myfile.gz";  
  BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(path));  
  bos.write(data);  
  bos.flush();  
  bos.close();
  </code></pre>
  
  <p>Solution#2</p>
  
  <pre><code>byte[] buffer = new byte[1024];
  byte[] data = mockRequest.getRawRequestData();
  def path="myfile.gz";
  BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(path));
  bos.write(data);
  bos.flush();
  bos.close();
  </code></pre>
  
  <p>Can someone please help and let me know why I cannot decompress the gzip file and how I can do that?</p>
  
  <p>Thanks,</p>