问题
How can I change the timeout when calling from the application to the adapter using WL.Client.invokeProcedure
?
I have read the answer in the following post, but it is not working: How to increase the adapter procedure timeout value in Worklight?
My configuration:
initOptions.js
timeout: 600000
Adapter XML
<procedure name="addInsertarMensaje" securityTest="wl_unprotected" requestTimeoutInSeconds="600">
Adapter invocation
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.
Is there a max value?
These are the traces in each part.
In the app:
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.
In the adapter receiving the invocation from the app:
[2/12/13 14:31:45:224 CET] 000000bf ht.integration.js.JavaScriptIntegrationLibraryImplementation I Custom Trace. Into Adapter implementation.
In the adapter receiving the answer from the host:
[2/12/13 14:33:34:714 CET] 000000bf ht.integration.js.JavaScriptIntegrationLibraryImplementation I Custom Trace. Received id: 3
回答1:
- The application is not calling the adapter. Basic diagram:
Application << >>[ Worklight Server << >> Adapter ]<< >> Backend
- Also, there is no maximum value Worklight imposes on timeouts. There's a default value, but you have changed it in all 3 locations.
Short explanation:
In initOptions.js, the
timeout
property relates to the amount of time the app will wait for a connection to the Worklight Server.In the adapter's XML, the
requestTimeoutInSeconds
property relates to the amount of time the Worklight Server will wait for a response from the Backend.In the invocation options, the
timeout
property relates to the amount of time the app will wait for a response from the Worklight Server.
In your case, the error points that you did not even reach the Worklight Server, let alone invoke the adapter procedure.
- Verify that your can reach the server; follow the instructions from the error message - try to load Worklight Console in your device's mobile browser
- Verify the device and server are in the same network
- Verify the firewall (if enabled) is not blocking any crucial ports or addresses
In case you did reach the Worklight Server, since obviously 600 seconds did not pass, I believe that the host is simply not reachable. Make sure that you are pointing to the correct host address and that nothing is preventing a connection to pass successfully.
If the host was found, and something else is not correct in the path or network, a response will be returned, but it will not wait 600 seconds.
来源:https://stackoverflow.com/questions/20326585/ibm-worklight-6-0-0-1-timeout-setting-in-adapters