Code 1<?php 2//包含提供服务的类进来 3require_once(‘PersonInfo.php‘); 4 5//wsdl方式提供web service,如果生成了wsdl文件则可直接传递到//SoapServer的构造函数中 6//$s = new SoapServer(‘PersonInfo.wsdl‘); 7 8//doesn‘t work 只有location不能提供web service 9//output:looks like we got no XML document 10//$s = new SoapServer(null,array("location"=>"http://localhost/Test/MyService/Server.php")); 11 12//下面两种方式均可以工作,只要指定了相应的uri 13//$s = new SoapServer(null,array("uri"=>"Server.php")); 14$s=new SoapServer(null,array("location"=>"http://localhost/Test/MyService/Server.php","uri"=>"Server.php")); 15 16$s-> setClass("PersonInfo"); 17 18$s-> handle(); 19?>