80,351
社区成员
发帖
与我相关
我的任务
分享
jsoEvent = {"eventTitle":"111","eventCreatedTime":"Sat Aug 18 13:57:39 格林尼治标准时间+0800 2012","cmd":"AddEvent","now":"2012-08-18 13:57:50","eventContent":"2222"}
String eventUrl = "http://192.168.1.101:8080/TourUI/android_processAdd.ashx?a="+jsonEvent;
传入服务器,通过org.apach.http包,public String getResponse(String url, DefaultHttpClient httpClient){
String strResult = null;
HttpGet httpRequest = new HttpGet(url);//到这一行就不执行了,
try {
HttpResponse httpResponse = httpClient.execute(httpRequest);
if(httpResponse.getStatusLine().getStatusCode()==HttpStatus.SC_OK){
//EntityUtils httpResponse.getEntity()
strResult = retrieveInputStream(httpResponse.getEntity());
}
else{
strResult = "无结果";
}
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
strResult = "无结果1";
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
strResult = "无结果2";
e.printStackTrace();
}finally{
httpRequest.abort();//结束请求
}
return strResult;
}
在这一句HttpGet httpRequest = new HttpGet(url);就不在2想下执行了,我认为是url的问题,是不是因为jsonEvent中引号的问题,求教大神该如何解决