0
我是新的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文件。 –