21,886
社区成员
发帖
与我相关
我的任务
分享
$a = new SoapClient("http://localhost/soap/webServices.php?wsdl");
echo $a->HelloWorld();
echo("<br />");
echo $a->Add(1,2);
运行后得到
<?php
class Service{
/**
* Add Function (Can not use Chinese)
*
* @return string
*/
public function HelloWorld(){
return "hello world;";
}
/**
* Add Function (Can not use Chinese)
*
* @param integer $a
* @param integer $b
* @return integer
*/
public function Add($a,$b){
return $a+$b;
}
}
//TestSoap.wsd需要在后面采用Zend Studio生成
$server = new SoapServer('TestSoap.wsdl',array('soap_version' => SOAP_1_2));
$server -> setClass("service");
$server -> handle();
?>