php webservice soap简单实例
action.php文件内容
?php Class Action { public total($num1,$num2){ $num1 $num2; } } ?
service.php文件内容
?php require ; $server SoapServer(); $serversetClass(); $serverhandle(); ?
action.wsdl文件内容
?xml version encoding? ! WSDL file generated by Zend Studio. definitions name targetNamespace xmlns:typens xmlns:xsd xmlns:soap xmlns:soapenc xmlns:wsdl xmlns message name part name type/ part name type/ /message message name part name type/ /message portType name operation name documentation Enter description here... /documentation input message/ output message/ /operation /portType binding name type soap:binding style transport/ operation name soap:operation soapAction/ input soap:body namespace use encodingStyle/ /input output soap:body namespace use encodingStyle/ /output /operation /binding service name port name binding soap:address location/ ! 访问service的路径 /port /service /definitions
index.php文件内容
?php $test SoapClient(); $result $testtotal(,); echo $result; ?
其中index.php为调用接口的文件,service.php为接口的服务文件,运行index.php就可以直接得到接口返回的值