Topic
1 reply Latest Post - ‏2011-12-09T21:48:07Z by SystemAdmin
SystemAdmin
SystemAdmin
59 Posts
ACCEPTED ANSWER

Pinned topic mysurance Android client not validating the server address correctly

‏2011-12-09T21:28:53Z |
I downloaded the mobile toolkit preview, and was able to get the rest service up and running on WAS 8.0 (tested it with the simpleTest.html page, and debugged the call, so am pretty certain it works). I was also able to get mysurance up and running on the android emulator. Everything seemed to be working, but when I traced the call back to the server, although everything comes back normally in the logCat, on closer inspection it looks like the server calls to the REST service are not being made. Specifically the validateServerAddress method (step12.html) seems busted. It seems to find http://w a valid address (which is impossible if it actually did an xhrGet, unless I am mistaken)

function validateServerAddress(serverAddress){
console.log("validateServerAddress->", serverAddress);
var tmpServerAddress = dojo.byId(serverAddress).value;
var targetNode = dojo.byId("serverAddressStatus");

targetNode.innerHTML = "Trying to connect to server " + tmpServerAddress;

dojo.xhrGet({url:"http://"+ tmpServerAddress + "/index.html",
sync:false,
load: function(){
serverAddressChanged(tmpServerAddress);
targetNode.innerHTML = "Server address set to " + tmpServerAddress;
},
error: function(){
targetNode.innerHTML = "Host not reachable " + tmpServerAddress;
},
timeout: 5000});

}
A "host is unreachable" error message is displayed in the emulator if I don't specify http://, otherwise it validates any garbage I put in as long as its preceded by http://. Has anyone else run into this? Any help would be much appreciated. Thanks!
Updated on 2011-12-09T21:48:07Z at 2011-12-09T21:48:07Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    59 Posts
    ACCEPTED ANSWER

    Re: mysurance Android client not validating the server address correctly

    ‏2011-12-09T21:48:07Z  in response to SystemAdmin
    I got it to work when i appended the project name to the url. Just posting an FYI. eg: 10.9.8.7:9080/mysurance