php 中的 SOAP 服务器错误?

SOAP server error in php?

我想在非 wsdl 模式下通过 SOAP 连接两台计算机。 为了测试,我写了两个文件,hello_client.php 和 hello_server.php 但它显示错误。

"Fatal error: Uncaught SoapFault exception: [Client] DTD are not supported by SOAP in E:\xampp\htdocs\test_server\wsdl\hello_client.php:10 Stack trace: #0 E:\xampp\htdocs\test_server\wsdl\hello_client.php(10): SoapClient->__call('addNumber', Array) #1 E:\xampp\htdocs\test_server\wsdl\hello_client.php(10): SoapClient->addNumber(10, 10) #2 {main} thrown in E:\xampp\htdocs\test_server\wsdl\hello_client.php on line 10"

我的代码:

// hello_client.php
 $options = array(
'uri' => 'http://host_name/test_server',
'location' => 'http://host_name/test_server/wsdl/hello_server',
 );

 $client = new SoapClient(null, $options);

 echo $client->addNumber(10, 10);




//hello_server.php
function addNumber($x, $y)
{
return $x + $y;
}

$options = array(
'uri' => 'http://host_name/test_server',
'location' => 'http://host_name/test_server/wsdl/hello_server',
);


$server = new SoapServer(null, $options);
$server->addFunction("addNumber");
$server->handle();

一个小错误。 错误出现在hello_client.php。 替换

 $options = array(
 'uri' => 'http://host_name/test_server',
 'location' => 'http://host_name/test_server/wsdl/hello_server',
  );

 $options = array(
 'uri' => 'http://host_name/test_server',
 'location' => 'http://host_name/test_server/wsdl/hello_server.php',
  );