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.
<?php
class city
{
public $id;
public $description;
public $uf;
}
$objcity = new city ;
$objcity -> id = 1 ;
$objcity -> description = 'MY CITY' ;
$objcity -> uf = 'XX' ;
$url = 'http://192.168.1.101:8088/datasnap/rest/TServerMethodsMain/AddCity/' ;
$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) :
Warning: file(http://192.168.1.101:8088/datasnap/rest/TServerMethodsMain/AddCity/{"id":1,"description":"MY 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 !