简单的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
class usrHelper
{
public function test()
{
return "this is a test";
}
}
?>
<?php
require_once 'usrHelper.php';
$server = new SoapServer(null,
array('uri' => "usr_service"));
$server->setClass('usrHelper');
$server->handle();
?>
$client = new SoapClient(null, array(
'location' => "http://127.0.0.1/photowall/server.php",
'uri' => "usr_service",
'trace' => 1 ));
//$client->addUsr($username,$password);
$ans = $client -> test();
echo $ans;