Hi,
I have a problem with passing javascript objects to my PHP RPC Server as
a parameter.
Does anybody know whats wrong here ?

thanks in advance,
Connor.

With the PHP RPC Server I've adjusted the echo method to:

    function method_echo($params, $error)

    {

        if (count($params) != 1)

        {

            $error->SetError(JsonRpcError_ParameterMismatch,

                             "Expected 1 parameter; got " . count($params));

            return $error;

        }

        

        $retval[] = "Test";

        $retval[] = "Client said: " . $params[0]["left"][0];

        return $retval;

    }


and passed the parameter by the qooxdoo application like

       try {

        var result = rpc.callSync("echo", {"left":["top","XYZ"]});

            alert("Result of sync call: " + result);

       } catch (exc) {

        alert("Exception during sync call: " + exc);

       }


This causes an error message in php:

/*
( ! ) Fatal error: Cannot use object of type stdClass as array in
C:\XAMPP\xampp\htdocs\rpc\qooxdoo\services\class\tmlproxy\tml.php on
line /59/
Call Stack
#       Time    Memory  Function        Location
1       0.0007  336568  {main}( )       ..\index.php*:*0
2       0.0091  772536  JsonRpcServer::run( )   ..\index.php*:*34
3       0.0121  780008  JsonRpcServer->start( )         
..\JsonRpcServer.php*:*141
4       0.0121  780848  AbstractServer->start( )        
..\JsonRpcServer.php*:*165
5       0.0409  1044480         JsonRpcServer->callServiceMethod( )
..\AbstractServer.php*:*599
6       0.0410  1044480         AbstractServer->callServiceMethod( )
..\JsonRpcServer.php*:*347
7       0.0410  1045944         class_tml->method_echo( )       
..\AbstractServer.php*:*941

*/{ error: { "origin":1, "code":-1, "message":"Fatal PHP Error. See
response content for error description "}}

The Post seems to be correct:

        
        
        
        
        
        


        
        
        
        
        

        
POST index.php?nocache=1338562470553
        
200 OK
        
localhost:8080
        
3.1 KB
        
::1:8080
        
 
51ms
ParameterHeaderPostAntwortHTML
JSON

        
        

        
id
        9

        
method
        "echo"

        
params
        [Object { left=[2]}]

        
service
        "tmlproxy.tml"

Quelle
|{"service":"tmlproxy.tml","method":"echo","id":9,"params":[{"left":["top","XYZ"]}]}|


        
1 Anfrage
        
        
        
3.1 KB
        
51ms


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to