Web 服务业务操作客户端 – 响应超时行为
调用 Web 服务的过程中,在期望的时间内未返回响应时,后续发生的情况由业务操作的几个设置来控制。
(请注意,这也与非 SOAP 简单 HTTP 调用等有关)
3 个主要设置为:
指定从远程 Web 服务器获取响应的超时时间。
尝试与 Ensemble 之外的目标进行连接之间等待的秒数。
尝试与 Ensemble 之外的目标保持连接的总秒数。 经过此秒数时间后,业务操作将丢弃消息数据并返回错误代码。
归纳一下就是这样:
我们将等待 Web 服务器的响应,时间为“响应超时”所用的时间。 如果此时间过后未收到响应,我们将在“重试间隔”时间过后再次调用 Web 服务器。 如此继续尝试,直到时间(从第一次尝试算起)达到“故障超时”设置的时间秒数。
以下举例进行说明:
假定以下设置:
就是说:
响应超时 - 等待 7 秒以响应
重试间隔 - 每 10 秒重试一次
故障超时 – 30 秒后“放弃”重试
假定在 8 秒后返回响应,则情况如下:
以下是上述示例的调用“证据”。
首先是服务器端 [来自 SOAP 日志] – 可以看到,其收到了 4 次调用/请求,均相隔 10 秒,每次在请求发出 8 秒后返回一个响应:
05/31/2016 14:18:45 *********************
Input to Web service with SOAP action = http://tempuri.org/Test.WSTimeouts.WebService.GetResponse
...
05/31/2016 14:18:53 *********************
Output from Web service with SOAP action = http://tempuri.org/Test.WSTimeouts.WebService.GetResponse
...
05/31/2016 14:18:55 *********************
Input to Web service with SOAP action = http://tempuri.org/Test.WSTimeouts.WebService.GetResponse
...
05/31/2016 14:19:03 *********************
Output from Web service with SOAP action = http://tempuri.org/Test.WSTimeouts.WebService.GetResponse
...
05/31/2016 14:19:05 *********************
Input to Web service with SOAP action = http://tempuri.org/Test.WSTimeouts.WebService.GetResponse
...
05/31/2016 14:19:13 *********************
Output from Web service with SOAP action = http://tempuri.org/Test.WSTimeouts.WebService.GetResponse
...
05/31/2016 14:19:15 *********************
Input to Web service with SOAP action = http://tempuri.org/Test.WSTimeouts.WebService.GetResponse
...
05/31/2016 14:19:23 *********************
Output from Web service with SOAP action = http://tempuri.org/Test.WSTimeouts.WebService.GetResponse
...
现在,从 Ensemble BO/客户端,可以看到,有 4 次尝试,均相隔 10 秒,每次在 7 秒后记录响应超时错误。
客户端
05/31/2016 14:18:45 *********************
Output from Web client with SOAP action = http://tempuri.org/Test.WSTimeouts.WebService.GetResponse
...
05/31/2016 14:18:52 *********************
Input to Web client with SOAP action = http://tempuri.org/Test.WSTimeouts.WebService.GetResponse
ERROR #5922: Timed out waiting for response
string**** SOAP client return error. method=GetResponse, action=http://tempuri.org/Test.WSTimeouts.WebService.GetResponse
ERROR #5922: Timed out waiting for response
05/31/2016 14:18:55 *********************
Output from Web client with SOAP action = http://tempuri.org/Test.WSTimeouts.WebService.GetResponse
...
05/31/2016 14:19:02 *********************
Input to Web client with SOAP action = http://tempuri.org/Test.WSTimeouts.WebService.GetResponse
ERROR #5922: Timed out waiting for response
string**** SOAP client return error. method=GetResponse, action=http://tempuri.org/Test.WSTimeouts.WebService.GetResponse
ERROR #5922: Timed out waiting for response
05/31/2016 14:19:05 *********************
Output from Web client with SOAP action = http://tempuri.org/Test.WSTimeouts.WebService.GetResponse
...
05/31/2016 14:19:12 *********************
Input to Web client with SOAP action = http://tempuri.org/Test.WSTimeouts.WebService.GetResponse
ERROR #5922: Timed out waiting for response
string**** SOAP client return error. method=GetResponse, action=http://tempuri.org/Test.WSTimeouts.WebService.GetResponse
ERROR #5922: Timed out waiting for response
05/31/2016 14:19:15 *********************
Output from Web client with SOAP action = http://tempuri.org/Test.WSTimeouts.WebService.GetResponse
...
05/31/2016 14:19:22 *********************
Input to Web client with SOAP action = http://tempuri.org/Test.WSTimeouts.WebService.GetResponse
ERROR #5922: Timed out waiting for response
string**** SOAP client return error. method=GetResponse, action=http://tempuri.org/Test.WSTimeouts.WebService.GetResponse
ERROR #5922: Timed out waiting for response
以下是对 Ensemble 的可视化跟踪:
以下是事件日志条目:
以下为跟踪事件的日志示例[您可能需要放大以更好地读取文字]:
由此,可以看到上述示例的一些“内部运作”:
在日志行 ID #684,执行了首次调用 – 时间:17:09:16。
然后,在 7 秒之后 (09:23),我们收到响应超时错误 (#685)。 然后,操作记录了此错误 (#687),并确定等待 3 秒钟,直到达到重试间隔时间;10 秒重试间隔时间减去 7 秒响应超时时间 (#688-#690)。
经过 3 秒等待( 09:26;#691)之后,进行第 2 次尝试 (#692),结果相同,继续重复操作,直到第 4 次尝试 (#704) 。 在第 4 次尝试失败(09:53;#705)之后,由于达到超时时间(30 秒),因此未进行另一次尝试。