HTTP 1.1 503 Service Unavailable

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/Dream_ling/article/details/86492440

在调用第三方接口的时候,获取返回的状态的方法: 创建post请求,

然后通过下面一行代码 执行post请求

CloseableHttpResponse response = (CloseableHttpResponse) httpclient.execute(httppost);

打印请求返回状态

System.out.println(response.getStatusLine());

返回结果

HTTP 1.1 503 Service Unavailable

百度了两个小时左右 有的说程序写错了。有的说阻塞。有的说应用池满了。。。

我的这种属于请求头不完整, 在借助Burp Suite工具对请求进行分析以后,拼接成完整的访问头部,返回值就正常了。

类似:httppost.setHeader("Content-Type", "application/json");

猜你喜欢

转载自blog.csdn.net/Dream_ling/article/details/86492440