我在soap客户端和soap服务器上遇到了一些问题。
服务器端的server.php
class Server {
public function hello($someone) {
return "Hello ". $someone;
}
}
$options= array('uri'=>'http://localhost/');
$server=new SoapServer(NULL, $options);
$server->setClass('Server');
$server->handle();
客户端index.php
<?php
$options = array('location' => 'http://localhost/server.php',
'uri' =>'http://localhost/');
$client = new SoapClient(NULL, $options);
echo $client->hello('Greg');
我在xampp上测试这个本地并获取错误: 我做错了什么?我可以测试它本地或我必须为此设置服务器。如果是,是否可以在IIS上运行它?
致命错误:未捕获的SoapFault异常:[HTTP]未找到 C:\ xampp \ htdocs \ SOAP \ index.php:8堆栈跟踪:#0 [内部函数]: SoapClient-&GT; __ doRequest(&#39; HTTP://localhos...' ;, &#39; http://localhos ...&#39;,1,0)#1 C:\ xampp \ htdocs \ SOAP \ index.php(8): SoapClient-&gt; __ call(&#39; hello&#39;,Array)#2 C:\ xampp \ htdocs \ SOAP \ index.php(8):SoapClient-&gt; hello(&#39; Greg&#39;)#3 {main} 在第8行的C:\ xampp \ htdocs \ SOAP \ index.php中抛出