Consuming a Datasnap Server with PHP passing JSONObject as parameter

I have a Datasnap Server and a have a method named :

function TServerMethodsMain.AddCity( ACity : TJSONObject ) : Boolean ;

I did small php code below to invoke this method.


class city
   public $id;
   public $description;
   public $uf;          

$objcity = new city ;

$objcity -> id          = 1         ;
$objcity -> description = 'MY CITY' ;
$objcity -> uf          = 'XX'      ;

$url  = '' ;
$url .= json_encode( $objcity ) ;

$page = file($url) ;  

$show = json_decode($page[0]);

echo '<pre>';

print_r ($show);

echo '</pre>';


I got this error message from browser (Firefox or IE) :

CITY”,”uf”:”XX”}) [function.file]:
failed to open stream: HTTP request
failed! HTTP/1.1 500 Internal Server
Error in
C:\xampp\htdocs\json-php\index.php on
line 19

Well, I have others methods that works fine with this php code, but only if I pass as parametrer Primitive Types : String, Integer…

I did a debug and see that problem happens at moment I need to convert parameter JSONObject into Object ( unMarshalll ). When I invoke this method by Client Delphi Win32 it works fine !

Does anybody knows anything about the problem ?

Thanks !

Leave a Reply


Hire Me
Follow Me!
Most Popular Articles & Pages
Because your vote is Important
Sorry, there are no polls available at the moment.