关于httpclient传送和接收数据的问题!!!!急~急~急~

问题描述:

  现要求,客户端向服务端以httpclient的post方式发送“XML格式的字符串”,服务器接收字符串数据,解析之后返回“XML格式的字符串”给客户端。
 


String url="http://localhost:8080/smartHN/regist/regist.action?method=userReg";
HttpClient hc = new HttpClient();
PostMethod post = new PostMethod(url);
post.setRequestBody ("<xml><name>long</name><age>24</age><address>wuhan</address></xml>");
try {
int state = hc.executeMethod(post);
if(state!=HttpStatus.SC_OK){
System.out.println("远程访问失败!");
}
System.out.println(post.getResponseBodyAsString());//反馈结果
} catch (HttpException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}


这是模拟客户端发送请求,代码可能存在问题~~
请教服务端action怎么接收这个XML字符串,希望详细一点~~~~~感谢!
问题补充
post.addParameter(new NameValuePair("xml","******"));

服务端通过request.getParameter("xml");是可以接收的。
我想知道还可以通过别的方式传递吗?
1、比如放在一个content里面或body里面,是怎么实现?
2、服务端接收数据之后进行处理之后返回客户端一个XML字符串,又是怎么实现?