以下是无wsdl模式
创建server端的时候,uri是基本需要的参数
<?php
function myMethod(){
return var_export(func_get_args(),true);
}
$soapServer = new SoapServer(null,array('uri'=>'http://localhost/test/soap/soapServer.php'));
$soapServer->addFunction('myMethod');
$soapHeader = new SoapHeader('namespace','namespace');
$soapServer->addSoapHeader($soapHeader);
$soapServer->handle();//接受客户端的请求并处理
客户端的代码
<?php
$client = new SoapClient(null,array('location'=>'http://localhost/test/soap/soapServer.php',
'uri'=>'http://localhost/test/soap/soapServer.php'));
$soapHeader = new SoapHeader('namespace','namespace');
$client->__setSoapHeaders($soapHeader);
var_dump( $client->__call('myMethod',array(1,2,3,4,5)) );
header看自己的需要,如果需要验证就带上header。