如何使用WL.Client.invokeProcedure
从应用程序调用适配器来更改超时?
我已在下面的帖子中阅读了答案,但它无效: How to increase the adapter procedure timeout value in 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
};
Android LogCat:
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.
在从app接收调用的适配器中:
[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
答案 0 :(得分:0)
Application << >>[ Worklight Server << >> Adapter ]<< >> Backend
简短说明:
在 initOptions.js 中,timeout
属性与应用等待连接Worklight Server的时间有关。
在适配器的XML 中,requestTimeoutInSeconds
属性与Worklight Server等待来自后端的响应的时间有关。
在调用选项中,timeout
属性与应用等待Worklight Server响应的时间有关。
在您的情况下,您甚至没有到达Worklight Server的错误点,更不用说调用适配器过程了。
如果您确实访问了Worklight Server,因为显然600秒没有通过,我相信主机根本无法访问。确保您指向正确的主机地址,并且没有任何因素阻止连接成功通过。
如果找到主机,路径或网络中的其他内容不正确,将返回响应,但不会等待600秒。