Reputation: 61
I am new to IBM Worklight, now started using Adapters and I am able to Run the application from Eclipse IDE but I need some help to Execute the same app in a device (iPAD/tablet).
I have created a worklight project with a simple html and onclick of a button i called a Http Adapter which simply calls a Java class and returns back a string. I have deployed the Adapter and mobile app in eclipse. On hitting http://localhost:8080/console
, I am able to see the adapter and the mobile application. On Clicking the button on mobile app, it brings the value from adapter, its working fine.
I have converted the application as an xcode project and connected my iPAD which identifies the mobile application and installs it in my iPAD, when clicking on the button present in the mobile application, the value from adapter is not displayed.
How and where to configure the adapter? Where to specify the mobile application that my adapter is been installed in so and so machine? please help me
Upvotes: 0
Views: 2071
Reputation: 1058
How and where to configure the adapter? Where to specify the mobile application that my adapter is been installed in so and so machine? please help me
Just as a quick clarification:
The adapter itself is a server side element. You wouldn't tell the app itself (when its deployed) to configure a connection to the adapter. You would, however, configure a connection to the Worklight server. Like Ravidor said, you may have to adjust the Worklight Server.
For testing, the localhost:8080 works fine on the same testing machine, but on mobile devices localhost points to the mobile device, not anything externally so it is actually looking for the server on itself.
Adjust the application descriptor to be the ip of the server (or the computer's actual ip address for testing).
The HTTP request done with the invokeProcedure method will then use the server address that is in the application descriptor to make a call to the Worklight Server which hosts the adapter in question.
Quick example:
My testing computer/server has ip of 192.168.1.5 Change the url portion that says localhost to 192.168.1.5 (the port remains the same at 8080). From there rebuild and deploy the app. When you use an emulator, the desktop browser, or even a real hardware device connected to the network (like the iPad), it will connect to that specific machine and port which host the jetty server.
On apple devices, you can override the settings in the iPad settings -> (app name). There should be a place to manually type in the new server location.
Hopefully that clears it up a bit.
Upvotes: 1
Reputation: 700
one small correct: if the application works in your desktop browser it doesn't guarntee it will work on the iPad.
usually the desktop browser is the same machine which runs the web server when testing. so in most cases the default hostname will be "localhost".
I can recommend you to avoid using "localhost" in worklight.properties and application-descriptor.xml and use your IP address. furthermore, that IP address should be accessible (via ping) from your mobile device. Firewalls/router may block such access so make sure you configure those correctly before! you run your app on the iPad.
Upvotes: 0
Reputation: 3583
Your problem is in the application descriptor.
From the device you can not access the Worklight server through localhost.
You need to give the the application-descriptor.xml a valid URL (http://<YOUR WROKLIGHT SERVER IP>:<PORT, USUALLY 8080>
).
Upvotes: 2
Reputation: 1736
If your application works in console ? if it is then it should work on device. Check the wifi or Gprs on device because Worklight application will access WL server using adapter. So you need proper internet connection. Please provide log may be u missed out to see error
Upvotes: 0