1

使用从应用程序调用适配器时如何更改超时WL.Client.invokeProcedure

我已阅读以下帖子中的答案,但它不起作用: 如何在 Worklight 中增加适配器过程超时值?

我的配置:

initOptions.js

timeout: 600000


适配器 XML

<procedure name="addInsertarMensaje" securityTest="wl_unprotected" requestTimeoutInSeconds="600">


适配器调用

var timeout = 600000;
var invocationOptions = {
  onSuccess: successSynchDoc,
  onFailure: errorSynchDoc,
  invocationContext: context,
  timeout: timeout
};


安卓日志猫:

12-02 11:23:04.603: D/Mapfre(21661): MyCustomTrace: Invoking the adapter

12-02 11:23:05.564: D/Mapfre(21661): Request [http://192.168.1.39:10080/xxx/apps/services/api/Mapfre/android/query]

12-02 11:23:26.214: D/Mapfre(21661): MyCustomTrace: After invoking the adapter

12-02 11:24:29.297: E/Mapfre(21661): [http://192.168.1.39:10080/xxx/apps/services/api/Mapfre/android/query] Host is not responsive. Try to manually access the URL through the android emulator browser to verify connectivity.


有最大值吗?

这些是每个部分的痕迹。

在应用程序中:

12-02 14:30:24.473: D/Mapfre(8641): Custom Trace. Just befor WL.Client.invokeProcedure
12-02 14:30:25.103: D/Mapfre(8641): Request [http://192.168.1.39:10080/xxx/apps/services/api/Mapfre/android/query]
12-02 14:31:42.670: E/Mapfre(8641): [http://192.168.1.39:10080/xxx/apps/services/api/Mapfre/android/query] Host is not responsive. Try to manually access the URL through the android emulator browser to verify connectivity.

在从应用程序接收调用的适配器中:

[2/12/13 14:31:45:224 CET] 000000bf ht.integration.js.JavaScriptIntegrationLibraryImplementation I Custom Trace. Into Adapter implementation.

在从主机接收答案的适配器中:

[2/12/13 14:33:34:714 CET] 000000bf ht.integration.js.JavaScriptIntegrationLibraryImplementation I Custom Trace. Received id: 3
4

1 回答 1

0
  • 应用程序没有调用适配器。基本图:

Application << >>[ Worklight Server << >> Adapter ]<< >> Backend

  • 此外,Worklight 没有对超时施加的最大值。有一个默认值,但您已在所有 3 个位置更改了它。

简短说明:

  1. initOptions.js中,该timeout属性与应用程序等待连接到 Worklight Server 的时间量有关。

  2. 适配器的 XML中,该requestTimeoutInSeconds属性与 Worklight Server 等待来自后端的响应的时间量相关。

  3. 调用选项中,该timeout属性与应用程序等待来自 Worklight Server 的响应的时间量相关。

在您的情况下,错误指向您甚至没有到达 Worklight Server,更不用说调用适配器过程了。

  • 验证您是否可以访问服务器;按照错误消息中的说明进行操作 - 尝试在您设备的移动浏览器中加载 Worklight Console
  • 验证设备和服务器是否在同一网络中
  • 验证防火墙(如果启用)没有阻止任何关键端口或地址

如果您确实到达了 Worklight Server,由于显然没有经过 600 秒,我相信主机根本无法访问。确保您指向正确的主机地址,并且没有任何东西阻止连接成功通过。

如果找到主机,并且路径或网络中的其他内容不正确,则会返回响应,但不会等待 600 秒。

于 2013-12-02T11:32:58.607 回答