简单的soap出错...
一直报错:
锘?
Fatal error: Uncaught SoapFault exception: [Client] looks like we got no XML document in E:\xampp\htdocs\photowall\registeraction.php:22 Stack trace: #0 E:\xampp\htdocs\photowall\registeraction.php(22): SoapClient->__call('test', Array) #1 E:\xampp\htdocs\photowall\registeraction.php(22): SoapClient->test() #2 {main} thrown in E:\xampp\htdocs\photowall\registeraction.php on line 22
上面那个乱码有点诡异....因为它是在我没有输出任何东西的情况下出现的....
不知道是神马意思....
求问各位大神到底哪里出错了...
下面是代码:
一个类,在usrHelper.php中:
<?php<br /> class usrHelper<br /> {<br /> public function test()<br /> {<br /> return "this is a test";<br /> }<br /> }<br /> ?>
<?php<br /> <br /> require_once 'usrHelper.php';<br /> <br /> $server = new SoapServer(null, <br /> array('uri' => "usr_service"));<br /> $server->setClass('usrHelper');<br /> $server->handle();<br /> ?>
<br /> $client = new SoapClient(null, array(<br /> 'location' => "http://127.0.0.1/photowall/server.php",<br /> 'uri' => "usr_service",<br /> 'trace' => 1 ));<br /> //$client->addUsr($username,$password);<br /> $ans = $client -> test();<br /> echo $ans;