title: Posting an xml document, but not via a request parameter but in the body
body: <p>I am currently posted an xml file to a url using this:</p>
  
  <pre><code>HttpClient client = new HttpClient();
  HttpPost post = new HttpPost("http://www.example.com/post/here");
  
  File f = new File("/path/to/file/file.txt");
  String str = Files.toString(f, Charset,defaultCharset());
  
  List&lt;NameValuePair&gt; nvp = new ArrayList&lt;NameValuePair&gt;(1);
  nvp.add(new BasicNameValuePair("payload", xmlFile));
  
  post.setEntity(new UrlEncodedFormEntity(nvp));
  
  HttpResponse response = client.execute(post);
  </code></pre>
  
  <p>But this is adding a request parameter of "payload" such that when I want to receive the value in my doPost servlet I will do:</p>
  
  <pre><code>request.getParameter("payload");
  </code></pre>
  
  <p>I'm guessing this parameter "payload" is in the request header?</p>
  
  <p>What I want to do is have this file sent in the body of the request, so in my doPost I will have to get the data from the stream, i.e.:</p>
  
  <pre><code>... = request.getInputStream();
  </code></pre>
  
  <p>How can I modify my code to do this? (using httpclient)</p>
  
  <p>Also, can someone explain the differences between the 2 when it comes to format of the request?</p>