Search code examples
androidibm-mobilefirst

Android - Worklight Hybrid application fails to connect to server in the emulator


I created a worklight application. I tried running that application on android emulator and i am getting the following error.

   [http://localhost:8080/apps/services/api/MyFirstApp/android/query] Host is not responsive.
    Try to manually access the URL through the android emulator browser to verify connectivity

So i tried to enter the same url in the emulator browser, i got the following text:

  /*-secure-
  {"WL-Authentication-Failure": {"wl_remoteDisableRealm":{"reason":"Login Failed}}} */

Can someone help me with this?

I am using Android OS version: 4.2.2, API level: 17

I haven't changed any application settings myself.. I am trying to go to a basic login page with the url "https://jazz.net/jazz/auth/j_security_check"

This is my adapter XML:

<wl:adapter xmlns:wl="worklight.com/integration"; xmlns:http="worklight.com/integration/http"; xmlns:xsi="w3.org/2001/XMLSchema-instance"; name="RQMAdapter">
    <displayName>RQMAdapter</displayName> 
    <description>HTTP type Worklight Adapter for jazz server</description>
    <connectivity> 
        <connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
            <protocol>https</protocol> 
            <domain>jazz.net</domain>
            </connectionPolicy>
        <loadConstraints maxConcurrentConnectionsPerNode="2" /> 
    </connectivity>

    <procedure name="loginToRQM" />
</wl:adapter>

This is my scenario: I have a requirement where I need to read information about the projects from jazz.net for a user. They are all available on the jazz server within an XML file. I need to process it to a mobile device to make it available on hand held device... So, now I am told that i will have to download some of the files from the server, so i need to have file IO on my app. I learned that we need to write this part using a Cordova plug-in in Worklight.

please let me know what else is needed for the solution... thank you


Solution

  • Make sure to place the actual IP address of your server machine:

    1. Change the value for worklightServerRootURL in the file application-descriptor.xml (located at: yourProject\apps\yourApp)
    2. Build and deploy
    3. Right-click on the generated Android project >> Run As >> Run application