![]() |
|
首页 │ Apache │ Linux│ Java│ MySQL│ 注册│帮助 | |||
server
---------------------------------------
function gettime(){
$time=strftime("%Y-%m-%d %H:%M:%S");
return $time;
}
function test(){
$srt= "helloword";
return $srt;
}
$soap = new SoapServer(null,array('uri'=>"http://test-uri/"));
$soap->addFunction('test');
$soap->addFunction('gettime');
$soap->addFunction(SOAP_FUNCTIONS_ALL);
$soap->handle();
client
----------------------------------------------------
try {
$client = new SoapClient(null, array('location' =>"http://***.***.com/application/soap/soapserver.php",'uri' => "http://test-uri/"));
$client->test();
} catch (SoapFault $fault){
echo "Fault! code:",$fault->faultcode,", string: ",$fault->faultstring;
}
---------------------------------
client 运行提示:
Fault! code:HTTP, string: Could not connect to host
有时候 提示
Fault! code:HTTP, string: Bad Request
为什么啊?? 'uri'=>"http://test-uri/" 是什么意思
phpinfo:
Soap Client enabled
Soap Server enabled
Directive Local Value Master Value
soap.wsdl_cache 1 1
soap.wsdl_cache_dir /tmp /tmp
soap.wsdl_cache_enabled 0 0
soap.wsdl_cache_limit 5 5
soap.wsdl_cache_ttl 86400 86400

