//使用多重发送方式,发送两个独立的两个XML Part,基于Content-Type="multipart/form-data"形式的表单 Part[] parts = {new StringPart("xmlhead",xmlHead,"UTF-8"),new StringPart("xmlbody",xmlBody,"UTF-8")}; //StringPart和FilePart都可以放进去 RequestEntity requestEntity = new MultipartRequestEntity(parts,method.getParams()); method.setRequestEntity(requestEntity); client.executeMethod(method);