java - http请求返回200,对方服务器一定是收到请求了吗?
天蓬老师
天蓬老师 2017-04-18 10:50:12
0
4
1115

Http请求,用response.getStatusLine().getStatusCode()判断返回值为200,是不是说明对方一定收到请求了?对方是IIS服务器,我的方法已经正确返回200,日志有打印,对方却一直咬定没有收到,我没有接触过IIS服务器,除了这个人以外,别的都没有问题!并且根据对方所说,并不是一直存在类似问题,一天会出现几次,抓包都不好抓!所以想请有遇到过类似问题或有经验丰富的开发帮助分析一下!

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(4)
迷茫

If the server returns 200, it can be confirmed that the server successfully received the client request. In this case, you can log all the messages returned by the server, including message header information, message body information and communication time. When this kind of problem occurs here, find the message based on the time of occurrence, and then compare this message with other messages to see if there is anything abnormal

巴扎黑

If it has not been hijacked, make sure your code is not written incorrectly. Then is

Ty80

It is possible that the other party returned an error with http 200, so the return status code you see here is fine, but the other party's server actually made an error

阿神

First of all, we need to understand what HTTP 200 is:

2xx successful

200 OK

The request has been successful, and the response header or data body expected by the request will be returned with this response.

201 Created

The request has been fulfilled, and a new resource has been created according to the request's needs, and its URI has been returned with the Location header information. If the required resources cannot be created in time, '202 Accepted' should be returned.

202 Accepted

The server has accepted the request but has not yet processed it. Just as it may be denied, the request may or may not ultimately be executed. In the case of asynchronous operations, there is no more convenient way than sending this status code.
The purpose of returning a 202 status code response is to allow the server to accept requests from other processes (such as a batch-based operation that is only performed once a day) without having to keep the client connected to the server until the batch operation is completed. . A response that accepts request processing and returns a 202 status code should contain some information in the returned entity indicating the current status of the processing, as well as a pointer to a processing status monitor or status prediction so that the user can estimate whether the operation has been completed.

203 Non-Authoritative Information

The server has successfully processed the request, but the returned entity header metainformation is not a definite set valid on the original server, but a copy from a local or third party. The current information may be a subset or a superset of the original version. For example, containing metadata for a resource may result in the origin server knowing a superset of the metainformation. Using this status code is not required and is only appropriate if the response would have returned 200 OK without this status code.

Secondly, if you receive a 200 request, it only means that the service was successfully received, and it does not mean whether the other party's business code can be received. Generally, companies will have network layers such as firewall services and distribution services, and some will have business gateway layers.

Finally, check the data format of the communication.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!