我已经尝试过了,我用SimpleXMLRPCServer制作了一个简单的Python,通过一个Python,我可以毫无问题地获得数据,但是我能从Qooxdoo获得这些数据吗?我迷路了,我已经找了三天了,但没有找到解决办法。
我试试看:
var JSON_lista_empresas = 1000
button1.addListener("execute", function(e)
{
var rpc = new qx.io.remote.Rpc();
rpc.setServiceName("get_data");
//rpc.setCrossDomain(true);
rpc.setUrl("http://192.168.1.54:46000");
rpc.addListener("completed", function(event)
{
console.log(event.getData());
});
rpc.callAsync( JSON_lista_empresas, '');
});我尝试了其他的选择,但一无所获:
指向文件的链接:
http://mieresdelcamin.es/owncloud/public.php?service=files&dir=%2Fjesus%2Ffiles%2FQooxdoo
我试着读了所有的奇奥多
井,
RpcPython -> Ok
在课堂上/qooxdoo -> test.py
从webroser运行服务器start-server.py和查询:
http://127.0.0.1:8000//?_ScriptTransport_id=1&nocache=1366909868006&_ScriptTransport_data={%22service%22%3A%22qooxdoo.test%22%2C%22method%22%3A%22echo%22%2C%22id%22%3A1%2C%22params%22%3A[%22Por%20fin%22]}韦布罗瑟的答复是:
qx.io.remote.ScriptTransport._requestFinished(1,{“错误”:null,"id":1,“结果”:“客户端说: Por fin”};
但是,如果我从qooxdoo (类似于答复)查询,则是error.png
qooxdoo的代码:
var rpc = new qx.io.remote.Rpc( "http://127.0.0.1:8000/");
rpc.setCrossDomain( true);
rpc.setServiceName( 'qooxdoo.test');
// asynchronous call
var handler = function(result, exc) {
if (exc == null) {
alert("Result of async call: " + result);
} else {
alert("Exception during async call: " + exc+ result);
}
};
rpc.callAsync(handler, "echo", "Por fin");我输了:(
档案载于:
http://mieresdelcamin.es/owncloud/public.php?service=files&dir=%2Fjesus%2Ffiles%2FQooxdoo
对于Firebug,owncloud qx.io.remote.ScriptTransport.....is检测中的此错误
?.
诚挚的问候。
发布于 2013-04-24 09:09:27
我猜您混淆了XML和JSON,而qooxdoo只支持后者。这些协议相似,但数据交换格式不同(XML或JSON)。您可以在服务器端使用“SimpleXMLRPCServer”代替RpcPython,这是一个qooxdoocont肋骨项目。
请参见:
一旦启动并运行了该服务器,就应该能够测试它:
之后,您的qooxdoo (客户端)代码希望也能工作。:)
发布于 2013-04-27 06:07:02
好的,
在qxjsonrc模块的http.py文件中,在第66行中更改
response='qx.io.remote.ScriptTransport._requestFinished(%s,%s);'%(scriptTransportID,response)为
response='qx.io.remote.transport.Script._requestFinished(%s,%s);'%(scriptTransportID,response)并运行罚款:))
修改包的此链接:
http://mieresdelcamin.es/owncloud/public.php?service=files&dir=%2Fjesus%2Ffiles%2FQooxdoo
衷心的问候和感谢!
发布于 2014-04-16 14:09:40
正如Richard已经指出的,只支持它的JSON风格。
我维护了一个名为QooxdooCherrypyJsonRpc的原始rpcpython分支。主要目标是将传输协议交给一些健壮的框架,只留下JSON。CherryPy显然是一个健壮的框架,它允许HTTP、WSGI和FastCGI部署。代码被重构,并覆盖了测试。后来,我添加了上传/下载支持和一致的时区数据交换。
至少您的Python后端看起来像(称为test.py):
import cherrypy
import qxcpjsonrpc as rpc
class Test(rpc.Service):
@rpc.public
def add(self, x, y):
return x + y
config = {
'/service' : {
'tools.jsonrpc.on' : True
},
'/resource' : {
'tools.staticdir.on' : True,
'tools.staticdir.dir' : '/path/to/your/built/qooxdoo/app'
}
}
cherrypy.tools.jsonrpc = rpc.ServerTool()
if __name__ == '__main__':
cherrypy.quickstart(config = config)然后,您可以在qooxdoo代码中这样做:
var rpc = new qx.io.remote.Rpc();
rpc.setServiceName('test.Test');
rpc.setUrl('http://127.0.0.1:8080/service');
rpc.setCrossDomain(true); // you need this for opening app from file://
rpc.addListener("completed", function(event)
{
console.log(event.getData());
});
rpc.callAsyncListeners(this, 'add', 5, 7);或直接打开链接:
http://127.0.0.1:8080/service?_ScriptTransport_id=1&_ScriptTransport_data=%7B%22params%22%3A+%5B12%2C+13%5D%2C+%22id%22%3A+1%2C+%22service%22%3A+%22test.Test%22%2C+%22method%22%3A+%22add%22%7D要获得更多信息,请查看我上面发布的软件包页面。
https://stackoverflow.com/questions/16173519
复制相似问题