我将数据发布到服务器,并以响应的形式返回发布数据...我使用此代码
PostMethod post = new PostMethod(this._serverUrl);
InputStream is=null;
is = new ByteArrayInputStream(postData.getBytes("UTF-8"));
post.setRequestEntity(new InputStreamRequestEntity(is));
post.setRequestHeader("Content-type", "text/xml; charset=ISO-8859-1");
HttpClient httpclient = new HttpClient();
int result = httpclient.executeMethod(post);
String response="";
response = post.getResponseBodyAsString();
我已经使用 commons apache httpclient 进行发布....在这里我得到响应
03-31 17:53:49.192: INFO/Response(2237): <?xml version="1.0" encoding="UTF-8"?>
03-31 17:53:49.192: INFO/Response(2237): <AndroidGame>
03-31 17:53:49.192: INFO/Response(2237): <Result>0</Result>
03-31 17:53:49.192: INFO/Response(2237): <ErrorCode>509</ErrorCode>
03-31 17:53:49.192: INFO/Response(2237): <ErrorMsg>You are using wrong Super Password</ErrorMsg>
03-31 17:53:49.192: INFO/Response(2237): </AndroidGame>
但是我需要以字符串形式获得响应...。我无法在单个字符串中获得响应...它以块的形式出现...任何人都可以帮助我