Hello all!

I'm trying to make a test application to work with RPC and Ajax. I'm
using Django as a server using RPC4Django to create the methods.

RPC4Django expects to reveive the information using the POST method,
as if it receives GET it returns a web page with the method definition
(a nice feature indeed). I'm trying to connect both platforms but
without success for the moment:

RPC

It seems is always sent by GET. Here is my code:

callRpcServer: function ()
      {
        var rpc = new qx.io.remote.Rpc();
        rpc.setTimeout(10000);
        rpc.setUrl("http://localhost:8000";);
        rpc.metod='POST';
        rpc.setServiceName("RPC2");
        rpc.setCrossDomain(true);

        // call a remote procedure -- takes no arguments, returns a string
        var that = this;
        this.RpcRunning = rpc.callAsync(
          function(result, ex, id)
          {
            that.RpcRunning = null;
            if (ex == null) {
                alert(result);
            } else {
                alert("Async(" + id + ") exception: " + ex);
            }
          },
          "system.listMethods");
      }

and Firebug shows:

http://localhost:8000/?_ScriptTransport_id=1&nocache=1250760522495&_ScriptTransport_data=%7B%22service%22%3A%22RPC2%22%2C%22method%22%3A%22system.listMethods%22%2C%22id%22%3A1%2C%22params%22%3A%5B%5D%7D

So the problem is that there is no way to set the method as POST

I have also tried using an ajax call, but it also makes a GET request
instead of a pots one. The code I'm calling is

callPost:function() {
        var url = "http://localhost:8000/RPC2";;
        var req = new qx.io.remote.Request(url, "POST", "application/json");
        var data ='{"params":[],"method":"system.listMethods","id":123}';
        req.setMethod('POST');
        req.setData(data);
        req.setCrossDomain(true)
        req.addListener("completed", function(e) {
            alert(e.getContent());
        });
        req.send();
    }

and the firebug says we're sending:

http://localhost:8000/RPC2?_ScriptTransport_id=2&nocache=1250760778483&_ScriptTransport_data=%7B%22params%22%3A%5B%5D%2C%22method%22%3A%22system.listMethods%22%2C%22id%22%3A123%7D

Any ideas?

-- 
Antoni Aloy López
Blog: http://trespams.com
Site: http://apsl.net

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to