title: Content Type header for POST request
body: <p>I have in Java (similar in other languages, problem should be language independent) a POST request I am sending to the server. The POST request contains only some POST parameters no body.</p>
  
  <p>I basically have this:</p>
  
  <pre><code>postData = URLEncoder.encode("user", "UTF-8") + "=" + URLEncoder.encode("jackychan", "UTF-8");
  //HttpSessionToken.setRequestProperty("Content-Type", "application/xml");
  OutputStream postContent = (OutputStream)HttpSessionToken.getOutputStream();
  postContent.write(postData.getBytes("UTF-8"));
  </code></pre>
  
  <p>This works fine. The question is around the second line, a comment at the moment. Uncommenting this line ruins my code, okay my data is not XML so I can understand this. To some REST services you have to POST a whole XML document, but no POST parameters, something like this</p>
  
  <pre><code>postData = "&lt;xml&gt; whatever xml structure here &lt;/xml&gt;"  
  HttpSessionToken.setRequestProperty("Content-Type", "application/xml");
  OutputStream postContent = (OutputStream)HttpSessionToken.getOutputStream();
  postContent.write(postData.getBytes("UTF-8"));
  </code></pre>
  
  <p>This works too. The difference is the postData is now an XML and the content type is set.</p>
  
  <p>The question now is, what if a Service requires BOTH, POST parameters as in example 1 AND an xml body as in example 2. How would I do this? If that never happens, why doesn't it happen?</p>
  
  <p>Thanks, A.</p>