views:

158

answers:

1

My capstone team has decided to use Qooxdoo as the front end for our project. We're developing apps for OpenFlow controllers using NOX, so we're using the NOX webservices framework. I'm having trouble getting data from the service; I know the service is running because if I go to the URL using Firefox the right data shows up. Here's the relevant portion of my code:

var req = new qx.io.remote.Request("http://localhost/ws.v1/hello/world",
                                   "GET", "text/plain");

req.addListener("complete", function(e) {
  this.debug(e.getContent());
});

var get = new qx.ui.form.Button("get");
get.addListener("execute", function() {
  alert("The button has been pressed");
  req.send();
}, this);
form.addButton(get);

In the firebug console I get this message after I click through the alert:

008402 qx.io.remote.Exchange: Unknown status code: 0 (4)

And if I press the Get button again I get this error:

027033 qx.io.remote.transport.XmlHttp[56]: Failed with exception: [Exception... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIXMLHttpRequest.open]" nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)" location: "JS frame :: file:///home/user/qooxdoo-1.0-sdk/framework/source/class/qx/io/remote/transport/XmlHttp.js :: anonymous :: line 279" data: no]

I've also looked at the Twitter Client tutorial, however the "dataChange" event I set up in place of the "tweetsChanged" event never fired. Any help is appreciated, thank you.

+4  A: 

This sound like a cross domain request issue. qx.io.remote.Request uses XHR for transporting the data which may not work in every case due to the browser restriction. Switching the crossDomain flag on the request to true will change from XHR to a dynamically inserted script tag doesn't have the cross domain restriction (but other restrictions).

req.setCrossDomain(true);

Maybe that solves your problem. Additionally, you can take a look at the documentation of the remote package to get some further details on cross domain requests: http://demo.qooxdoo.org/current/apiviewer/#qx.io.remote

Also take care not to use a request object twice. The only work once.

Martin Wittemann
Thank you! It was a cross domain problem, so I had to get the Qooxdoo app served up by our NOX app and then turn of the cache prevention mechanism so there wouldn't be any query string attached to the request. (I suppose I could have tried fixing it from the server end of things, but I'll burn that bridge if I come to it.) Anyway, it's working now!
Andy