问题描述
正如标题中所说,我正在尝试制作一个计算器,用户可以在其中输入数字并执行最基本的操作。问题是当我运行它时客户端部分不起作用,屏幕保持空白,我已经检查了库的路由,它们非常好所以我不知道故障在哪里,在这里我附上代码客户端和服务器。
服务器代码:
<?PHP
error_reporting(0);
include('lib/nusoap.PHP');
$server = 'MiServicio';
$servicio = new soap_server();
$servicio->configureWSDL($server,'urn:servidor');
$servicio->register("calculadora",array("x" => "xsd:int","y" => "xsd:int"),array("return" => "xsd:string")
);
function calculadora($x,$y,$operacion){
if($operacion == "suma")
return $x+$y;
else if($operacion == "suma")
return $x + $y;
else if($operacion == "resta")
return $x - $y;
else if($operacion == "multiplica")
return $x * $y;
else if($operacion == "divide")
return $x / $y;
return 0;
}
$servicio->service(file_get_contents("PHP://input"));
?>
客户端代码:
<?PHP
error_reporting(0);
include('lib/nusoap.PHP');
$cliente = new nusoap_client("http://localhost:90/ejercicio3/servidorcaculadora.PHP?wsdl",true);
$resultado = $cliente -> call("calculadora",array("x"=> '3','y' =>4,'operacion'=>'multiplica'));
echo($resultado)
?>