【问题标题】:SOAP server error in php?php中的SOAP服务器错误?
【发布时间】: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


    【解决方案1】:

    一个小错误。 错误在 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',
      ); 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-04-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多