Making an HttpRequest with MultipartEntity in it <p>I've been frustrated at trying to figure out how to make an http request with a multipart entity in it. The multipart has a custom boundary but I can't seem to be able to set it. My code below results in a response message of saying that my message does not contain multiple parts. </p> <pre><code>HttpPut addDoc = new HttpPut(url); addDoc.addHeader("Content-Type", "multipart/related; boundary=\"END_OF_PART\""); String bodyString = "Test for multipart update"; String titleString = "Title Test for multipart update"; MultipartEntity entity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); StringBody title = new StringBody(titleString, "application/atom+xml",Charset.forName("UTF-8")); StringBody body = new StringBody(bodyString, "text/plain",Charset.forName("UTF-8")); entity.addPart("title", title); entity.addPart("body", body); addDoc.setEntity(entity); </code></pre>