Android - Worklight Hybrid application fails to co

2019-07-26 16:13发布

问题:

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

回答1:

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


回答2:

If you are using using Worklight 5.0.5, make sure to upgrade to 5.0.6, where a fix is available when only API Level 17 is installed.

As for going to that URL, you need to explain where exactly you're trying to go to it from, and how... you need to be more descriptive. It sounds to me like you haven't gone through the Getting Started material. Please do.



回答3:

I had the same problem.

I have solved it by using the real IP address of the server in the WL app instead of using localhost:

  1. When the emulator is running your app, press the Menu button.
  2. Select to change your server URL
  3. Remove "localhost" and use the IP address.
  4. Accept and try again.

This fixed my problem.