我是Web服务中的新手。我通过遵循本教程创建了Web服务。服务器工作正常,但是当我在浏览器中运行客户端时,它什么也没有显示。
server.php 与教程相同。
client.php
<?php
require_once('lib/nusoap.php');
//This is your webservice server WSDL URL address
$wsdl = "http://localhost/web%20service/client.php?wsdl";
//create client object
$client = new nusoap_client($wsdl, 'wsdl');
$err = $client->getError();
if ($err) {
// Display the error
echo '
Constructor error
' . $err;
// At this point, you know the call that follows will fail
exit();
}
//calling our first simple entry point
$result1=$client->call('hello', array('username'=>'achmad'));
print_r($result1);
//call second function which return complex type
$result2 = $client->call('login', array('username'=>'john',
'password'=>'doe') );
//$result2 would be an array/struct
print_r($result2);
?>
我正在使用Wamp服务器。
自己解决了。我刚刚从项目文件夹名称中删除了空白空间,现在它的工作正常。