Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/backbone.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Web services 使用Qooxdoo从Web服务获取数据时遇到问题_Web Services_Qooxdoo - Fatal编程技术网

Web services 使用Qooxdoo从Web服务获取数据时遇到问题

Web services 使用Qooxdoo从Web服务获取数据时遇到问题,web-services,qooxdoo,Web Services,Qooxdoo,我的capstone团队决定使用Qooxdoo作为我们项目的前端。我们正在使用NOX为OpenFlow控制器开发应用程序,因此我们正在使用NOX webservices框架。我无法从服务获取数据;我知道该服务正在运行,因为如果我使用Firefox访问URL,就会显示正确的数据。以下是我代码的相关部分: var req = new qx.io.remote.Request("http://localhost/ws.v1/hello/world",

我的capstone团队决定使用Qooxdoo作为我们项目的前端。我们正在使用NOX为OpenFlow控制器开发应用程序,因此我们正在使用NOX webservices框架。我无法从服务获取数据;我知道该服务正在运行,因为如果我使用Firefox访问URL,就会显示正确的数据。以下是我代码的相关部分:

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);
在firebug控制台中,单击警报后,我收到以下消息:

008402 qx.io.remote.Exchange: Unknown status code: 0 (4)
如果我再次按下“获取”按钮,就会出现以下错误:

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]

我也看过Twitter客户端教程,但是我设置的“dataChange”事件代替了“tweetsChanged”事件从未触发。非常感谢您的帮助。

这听起来像是跨域请求问题
qx.io.remote.Request
使用XHR传输数据,由于浏览器的限制,这些数据在任何情况下都可能无法工作。将请求上的
crossDomain
标志切换到
true
将从XHR更改为动态插入的
脚本
标记没有跨域限制(但有其他限制)

也许这能解决你的问题。 此外,您还可以查看远程包的文档,以获得有关跨域请求的更多详细信息:


还要注意不要两次使用请求对象。只有一次工作。

谢谢!这是一个跨域问题,所以我必须让我们的NOX应用程序提供Qooxdoo应用程序,然后打开缓存预防机制,这样请求就不会附加任何查询字符串。(我想我可以尝试从服务器端修复它,但如果我来的话,我会烧了那座桥。)不管怎样,它现在工作了!
req.setCrossDomain(true);