如果您的xml是由
java.lang.String您编写的,则只能
HttpClient以这种方式使用
public void post() throws Exception{ HttpClient client = new DefaultHttpClient(); HttpPost post = new HttpPost("http://www.baidu.com"); String xml = "<xml>xxxx</xml>"; HttpEntity entity = new ByteArrayEntity(xml.getBytes("UTF-8")); post.setEntity(entity); HttpResponse response = client.execute(post); String result = EntityUtils.toString(response.getEntity()); }注意例外。
顺便说一句,该示例是由httpclient版本4.x编写的



