PHP企业级应用之WebService篇(2)
<?php
class Member
{
public $UserId;
public $Name;
public function __construct($parmas){
$this->UserId = $parmas[0];
$this->Name = $parmas[1];
}
}
$servidorSoap = new SoapServer('testphp.xml',array('uri' => 'http://www.TestPHP.com/','encoding'=>'utf-8','soap_version' => SOAP_1_2 ));
$servidorSoap->setClass(Testphp);
$servidorSoap->handle();
class Testphp {
public function HelloWorld($uid){
return array('HelloWorldResult'=>"mystring".$uid->{'uname'}.' and '.$uid->{'upassword'});
}
public function GetMember($uid){
$s=array();
for($i=0;$i<$uid->{'uid'};$i++){
$s[] =&new Member(array($i, $uid->{'uname'}.'我测试'.$i));
}
return array('GetMemberResult'=>$s);
}
}
?>
到这里应该都看的懂吧
下面是WSDL文件
相关新闻>>最新推荐更多>>>
|