Joe Walsh
Posts: 0
Joined: Thu Jul 12, 2012 12:21 am

REST service tests OK but fails when app is tested

After successfully completing the tutorial for the weather app, I though it would be a good idea to practice connecting to a different web service.

I decided I would make a simple app that checks the nationality of an IP Address. I'm using the GeoIPService (http://www.webservicex.net/geoipservi...)

I made a REST service with the appropriate parameters, and the service tests perfectly. But the service doesn't work when I'm testing the app.

I've made sure that the app was capturing input from the text box correctly. I also tried giving the REST request a default IP address, but that didn't solve the problem. The REST service works when I run the service test, but I doesn't work when I test the whole app. Any ideas on why this is happening?

My app is here: http://project.tiggzi.com/view/254f3b...

Here's my service configuration: Image

And here is the request parameter: Image

Joe Walsh
Posts: 0
Joined: Thu Jul 12, 2012 12:21 am

REST service tests OK but fails when app is tested

Thank you so much. It works now.

I feel a bit sheepish for having overlooked something that was already in the documentation. I'd have been stuck without you.

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

REST service tests OK but fails when app is tested

No worries, glad to help.

Joe Walsh
Posts: 0
Joined: Thu Jul 12, 2012 12:21 am

REST service tests OK but fails when app is tested

Hmm. As I removed some of the javascript that I used to debug, I discovered that unless I add a javascript call to alert(value) on the input from the text box, the service request will fail. This time, however, it fails with code 200 instead of 0. 0 is what is was before.

Does that call to alert() have some side effect?

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

REST service tests OK but fails when app is tested

200 usually means the service was invoked and you get a valid response back. Can you share the app link so I can try it?

Joe Walsh
Posts: 0
Joined: Thu Jul 12, 2012 12:21 am

REST service tests OK but fails when app is tested

I thought I did post the link: http://project.tiggzi.com/view/254f3b...

I've created an event for the service in case of error. If there's no error then it won't inform me of the return code. The fields aren't populated anyway, so I'm pretty sure the service is failing.

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

REST service tests OK but fails when app is tested

I think the error is coming from your service:

Image

Joe Walsh
Posts: 0
Joined: Thu Jul 12, 2012 12:21 am

REST service tests OK but fails when app is tested

It's possible that every once in a while the service might fail to receive the IPAddress parameter. However, if that were true then calling alert() before sending the request shouldn't have any effect. But it does, with perfect regularity, too. If I call alert() on the input, the request will succeed. If not, it fails.

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

REST service tests OK but fails when app is tested

I'm not sure why it's happening.. did you debug the app with Chrome Dev. Tools (or Firebug) to see what's happening?

Return to “Issues”