public static HttpResponse doPostOfQRCode(String url, String outStr) {
log.info("发送请求");
DefaultHttpClient client = new DefaultHttpClient();
HttpPost httpost = new HttpPost(url);
httpost.setEntity(new StringEntity(outStr, "UTF-8"));//使用setEntity方法,将我们传进来的参数放入请求中
int maxRetries = 3;
for (int i = 0; i < maxRetries; i++) {
try {
long start = System.currentTimeMillis();
HttpResponse response = client.execute(httpost);
log.info("请求耗时:{}ms", System.currentTimeMillis() - start);
log.info("请求数据:"+ "返回:"+JSONObject.toJSONString(response));
return response;
}catch (SocketTimeoutException e){
if (i<maxRetries-1){
log.info("第"+(i+1)+"次");
try {
Thread.sleep(1000 * (i + 1));
} catch (InterruptedException ex) {
throw new RuntimeException(ex);
}
}else{
log.error("请求超时:{}", e.getMessage());
}
}catch (IOException e){
log.error("网络异常:{}", e.getMessage());
}
}
return null;
}

你好,请优先排查下网络原因,稍后重试接口