Web服务响应问题

时间:2011-02-24 07:38:05

标签: android web-services

我从Web服务获取响应时遇到问题。

回复就像

  

org.apache.http.NoHttpResponseException:目标服务器无法响应

我无法找到合适的解决方案。

代码

HttpClient httpClient = new DefaultHttpClient(); 
HttpPost postRequest = new HttpPost(url) 

String temp = Base64Coder.encodeString(""); 
postRequest.setHeader("Authorization", temp); 

if(nameValuePair!=null) 
{ 
  postRequest.setEntity(new UrlEncodedFormEntity(nameValuePair,HTTP.UTF_8)); 
} 
HttpResponse response = httpClient.execute(postRequest); 
HttpEntity responseEntity = response.getEntity(); 
result = EntityUtils.toString(responseEntity, HTTP.UTF_8);

0 个答案:

没有答案