PHP NuSOAP服务器正在工作,但客户端什么也没有显示
问题描述:
我是新的Web服务。我通过遵循this tutorial创建了一个Web服务。服务器工作正常,但当我在浏览器中运行客户端时,它什么都不显示PHP NuSOAP服务器正在工作,但客户端什么也没有显示
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服务器。
答
自己解决了。我刚刚从项目文件夹名称中删除了一个空白区域,现在它工作正常。
你能显示你的wsdl文件内容吗? –
@Jeffrey Hitosis,你能告诉我什么是wsdl文件以及如何创建和使用它?我在下面的教程中也没有提到它。 – user220095
如果您运行http://localhost/web%20service/client.php?wsdl到您的浏览器,它将显示生成的xml文件。 –