无wsdl文件:
Clint.php         //客户端
<?php
    
    $soap = new SoapClient(null,array('uri'=>'server','location'=>'http://localhost/test/web_service/Service.php'));
    //location填写服务端的地址
    echo $soap->run();        
    
    echo $soap->add(10);

    //结果hello15
?>

Service.php       //服务端
<?php
class Service{
    
    public function run(){
        return "hello";
    }
    public function add($a,$b=5){
        return $a+$b;
    }
}

$soap = new SoapServer(null,array('uri'=>'asd'));    //两个uri参数必须一样,填写不限制
$soap->setClass('Service');        //类名
$soap->handle();
?>

//php.ini   开启extension=php_soap.dll;

 

 posted on 2017-05-09 16:49  の西瓜  阅读(166)  评论(0编辑  收藏  举报