【发布时间】:2015-02-27 23:39:50
【问题描述】:
我想通过 SOAP 在非 wsdl 模式下连接两台计算机。 为了测试,我写了两个文件,hello_client.php 和 hello_server.php 但它显示一个错误。
“致命错误:未捕获的 SoapFault 异常:[Client] DTD 不受 E:\xampp\htdocs\test_server\wsdl\hello_client.php 中的 SOAP 支持:10 堆栈跟踪:#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} 在第 10 行的 E:\xampp\htdocs\test_server\wsdl\hello_client.php 中抛出"
我的代码:
// 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();
【问题讨论】:
标签: php web-services soap wsdl