Problem getting data from a web service using Qooxdoo

My capstone team decided to use Qooxdoo as an interface for our project. We are developing applications for OpenFlow controllers using NOX, so we use the NOX web services infrastructure. I am having trouble getting data from the service; I know that the service works, because if I go to the URL using Firefox, the necessary data will appear. Here is the relevant part 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 clicking on a warning:

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

And if I press the Get button again, I will 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 also looked at the Twitter client tutorial, however the "dataChange" event, which I set instead of the "tweetsChanged" event, never fired. Any help is appreciated, thanks.

+4
source share
1 answer

This sound is like a cross domain problem. qx.io.remote.Request uses XHR to transport data that may not work in each case due to browser restrictions. Switching the crossDomain flag in the request to true will change from XHR to a dynamically inserted script tag that has no cross-domain restriction (but other restrictions).

 req.setCrossDomain(true); 

Perhaps this solves your problem. In addition, you can consult the documentation for the remote package for more information on cross-domain requests: http://demo.qooxdoo.org/current/apiviewer/#qx.io.remote

Also try not to use the query object twice. The only work once.

+4
source

Source: https://habr.com/ru/post/1303198/


All Articles