贝娄是我调用服务的代码,但它给出了超时异常
**DefaultHttpClient httpC = new DefaultHttpClient();
HttpProtocolParams.setUseExpectContinue(httpC.getParams(), false);
HttpConnectionParams.setConnectionTimeout(httpC.getParams(), 15000);
HttpConnectionParams.setSoTimeout(httpC.getParams(), 15000);
HttpPost httpPost = new HttpPost(WebServiceDetails.URL_WS_USER);
httpPost.setHeader("SOAPAction", soapAction);
try {
se = new StringEntity(serviceXml,HTTP.UTF_8);
se.setContentType("text/xml");
httpPost.setEntity(se);
BasicHttpResponse basicHttpResponse = (BasicHttpResponse)httpC.execute(httpPost);
HttpEntity responseEntity = basicHttpResponse.getEntity();
InputStream inputStream = null;
inputStream = responseEntity.getContent();
BufferedReader r = new BufferedReader(new InputStreamReader(inputStream),1024*5);
StringBuilder total = new StringBuilder();
String line;
while ((line = r.readLine()) != null) {
total.append(line);
}
System.out.println("Response from service -"+total.toString());
xmlContent=total.toString();
System.out.println(" status Line = "+basicHttpResponse.getStatusLine());
}catch (Exception e){e.printStackTrace();}**
它可以在模拟器上运行,但不能在实际设备上运行,如果错误,请提出任何教程或示例.......
谢谢x...