title: How to POST a XML file in jmeter body instead of a physical file
body: <p>I'm using JMeter 3.2. 
  My requirement is to read an XML file from the disk, replace some tags with dynamic values to ensure each thread sends a unique xml file upload (NOT SOAP Request). The following code  in JSR223 sampler works perfectly fine when I try to upload the newfile through POST using a http sampler with ${newfilename}   file    text/xml. </p>
  
  <pre><code>import org.apache.commons.io.FileUtils;
  
  try {
  
      String content = FileUtils.readFileToString(new File("E:/test.xml"));
  
          content = content.replaceAll("SUB_ID", "${__UUID}");   
          content = content.replaceAll("ABN_ID", "${empabn}");   
          content = content.replaceAll("EMPNAME", "${empname}");
  
          vars.put("content", content);
  FileUtils.writeStringToFile(new File("E:/testnew${empname}.xml"), content);
  
  
  } 
  catch (Throwable ex) {
  log.info("What happened?", ex);
  throw ex;
  }
  </code></pre>
  
  <p>Instead of writing again to the disk and uploading again, how can I send the contents of string 'content' as part of request body? I have looked at many posts that talk about the input output streams but they are confusing. When I try to send just ${content} in body, the application throws following error: </p>
  
  <pre><code>HTTP Status 500 - Could not write JSON: Name is null (through reference chain: com.xxx.xxx.datafile.rest.DataFileResponse[&amp;quot;validationStatus&amp;quot;]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: Name is null (through reference chain: 
  </code></pre>
  
  <p>Appreciate your help.</p>