How to invoke Restful services from the android/ios device?


#1

I got a very simple demo running which needs to execute the restful service.

How do I do this? I am not loading this app from the web server, so I am guessing I will have to specify the full url.

However, when I do that, I get this sort of issue in the device…

XMLHttpRequest cannot load https://dev-ua.deposco.com/solution/resources/handheld?action=startProcess&…lReceiving&sessionKey=SBI%7Csupport%7Cf04d75bc-d922-46cb-acbe-85da99ad06ac. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. 

#2

Have a look at the error. It say XMLHttpRequest. So you need a web server that can process HTTP requests.


#3

You need to enable CORS in your server side http://enable-cors.org/


#4

I do.

The problem is, it’s not even making a call. It stops at …

No ‘Access-Control-Allow-Origin’ header is present on the requested resource.


#5

In your //www/config.xml, you can set the origin.

For example, wide open would be as follows:

<access origin="*" />

#6

Thanks. I enabled CORS, and allowed access, and I am back to business.

Thanks.