0
votes

I am working on a IBM Worklight hybrid app POC. I am facing an issue with connecting an app to the WL server.

Once deployed on worklight console, when i view it in the browser, it's able to connect to the worklight server hosted on my local machine (even when the app is accessed from mobile chrome browser).

However after adding the Android environment and package the application in cordova container, and run the apk from my android device(build and run from eclipse), i am unable to connect to the worklight server hosted on my machine.

Both the device and my laptop are on the same network ( i accessed the worklight console app from device chrome browser, works fine).

I have verified the below

  1. that wlclient.properties points to my local machine IP
  2. that my worklight server is bound to that IP
  3. that i am running worklight server on port 80(to avoid any firewall issues, in fact i also turned my local firewall off)
  4. I captured packets using fiddler, could not see the request hitting the server.
1
You must provide the logs from the LogCat view in Eclipse. This will help in pin-pointing the issue. My guess is that you have changed the server address and port but the client is trying to connect to an incorrect server address nonethelessIdan Adar
Also clarify what does "and package the application in cordova container" mean. Do you mean you right-clicked the app and chose "run as > run on worklight development server"?Idan Adar

1 Answers

2
votes

If your application is set to connect to the server on startup and it is unsuccessful you should see the following dialog box "The application failed connecting to the service". To make sure it is attempting to connect to the correct address and context root click the "Details" button. You will then see in the following page a "Service URL" that shows the URL such as:

http://"address":"port"/"context root"/....

Make sure these settings match the address, port and context root of the server you are attempting to connect to. If they do attempt to connect to http://"address":"port"/"context root"/console in the devices browser to make sure the device has access to the server. Finally you can check the "Error Code" and "Error Message" portions inside the details page as well to provide us further diagnostic information.

Note: If you do not see the "Details" button explained above please make sure you have set the following in your applicationDescriptor for each specific environment (available on iOS and Android):

 <worklightSettings include="true"/>

More information can be found here: https://pic.dhe.ibm.com/infocenter/wrklight/v6r1m0/index.jsp?topic=%2Fcom.ibm.worklight.dev.doc%2Fdev%2Fc_setting_page.html&resultof%3D%2522worklight%2522%2520%2522settings%2522%2520%2522set%2522