Hi,

are you in control of the server? Can you add custom headers?
If the answer is "yes", then make sure that your server responds with 
this header (you should not use the wildcard symbol
for production only within your development environment [1]):

------
Access-Control-Allow-Origin: *
------

Then this snippet will work:

------
var desc1 = {
   "get": { method: "GET", url: "/key/value/one/two" }
};
var res1 = new qx.io.rest.Resource(desc1);
res1.setBaseUrl("http://echo.jsontest.com";);

res1.addListener("getSuccess", function(e) {
   console.log("s", e.getData());
});
res1.addListener("getError", function(e) {
   console.log("e", e.getData());
});

res1.get();
------

I'm using jsontest.com [2] and it's echo service [3] which responds with 
the "Access-Control-Allow-Origin" header shown above so you should be 
able to verify that this code snippet also runs on your machine.

It also runs in the playground (have a look at the console):
http://tinyurl.com/newe6da

This is the easiest and the preferred approach. If you are *not* in 
control of the server where the web service runs, I will have a look 
into REST and JSONP. Just let me know.

Regards
Richard

PS: You are using qx.Desktop, aren't you? Or do you want to use
qx.Website?

[1] 
https://developer.mozilla.org/en-US/docs/HTTP/Access_control_CORS#Simple_requests
[2] http://www.jsontest.com/
[3] http://echo.jsontest.com/key/value/one/two

> How should you use the REST module if the target service is in
> another domain?
>
> The Request object is HXR and does not work. I have tried to
> overwrite it with a Jsonp request but it did not work.
>
> All the examples in the docs and API are in a localhost.
> http://demo.qooxdoo.org/current/apiviewer/#qx.io.rest.Resource

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to