Home >Backend Development >PHP Tutorial >一个很奇怪的soap有关问题

一个很奇怪的soap有关问题

WBOY
WBOYOriginal
2016-06-13 10:08:131056browse

一个很奇怪的soap问题
新装的系统,apache根目录在/var/www/html下,
phpclient.php代码:
ini_set('display_errors', 1);
error_reporting(E_ALL);
$soap = new SoapClient("http://localhost/soap.wsdl");
var_dump ( $soap->__getFunctions () );

echo $soap->Add(1,2);

?>
soap.php代码:
class service
{
  public function HelloWorld()
  {
  return "Hello";
  }
  public function Add($a,$b)
  {
  return $a+$b;
  }
}
$server=new SoapServer("http://localhost/soap.wsdl",array('soap_version' => SOAP_1_2));
$server->setClass("service");
$server->handle();
?>
soap.wsdl代码:

















































一开赛的时候我是把soap.wsdl放在/var/www/html/wsdl文件夹里面的,原来的"http://localhost/soap.wsdl"为"http://localhost/wsdl/soap.wsdl" 可是不知道为什么报:Fatal error: Uncaught SoapFault exception: [HTTP] Not Found in的错误,路径是没错的呀?

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn