[Twisted-Python] still, txjson-rpc question

bino oetomo bino at indoakses-online.com
Sun Jan 15 21:56:56 EST 2012


Dear All ..
I just test my simple txjson-rpc server with PHP , and found it 'works'

Here is the also simple php script i use
------START---------
<?php
require_once './jsonRPCClient.php';
//php json rpc class is taken from http://jsonrpcphp.org/
$myExample = new jsonRPCClient('http://127.0.0.1:50008');

// performs some basic operation
echo '<b>Attempt to perform basic operations</b><br />'."\n";
try {
     echo 'Your name is <i>'.$myExample->aksi('This is PHP 
CALL').'</i><br />'."\n";
} catch (Exception $e) {
     echo nl2br($e->getMessage()).'<br />'."\n";
}

?>
------STOP----------

Looks like the serverside able to parse posted params
------Start: serverlog------------
2012-01-16 09:21:35+0700 [HTTPChannel,8,127.0.0.1] JSON MSG This is PHP CALL
2012-01-16 09:21:35+0700 [HTTPChannel,8,127.0.0.1] ------
2012-01-16 09:21:35+0700 [HTTPChannel,8,127.0.0.1]
2012-01-16 09:21:35+0700 [HTTPChannel,8,127.0.0.1]
2012-01-16 09:21:35+0700 [HTTPChannel,8,127.0.0.1] 127.0.0.1 - - 
[16/Jan/2012:02:21:35 +0000] "POST / HTTP/1.0" 200 43 "-" "-"
------STOP--------------------------

But there is still 'small' problem.

I just put ----> return 'OK' to the end of my rpc method,
but RPC client also need 'RESPON ID' with the same value of it's 
'REQUEST ID'

My PHP script catch this exception and said --> Incorrect response id 
(request id: 1, response id: )

Is there any clue to fix this problem ?

Sincerely
-bino-



More information about the Twisted-Python mailing list