不断获取无法连接到主机这是我拥有的服务器代码
<?php
ini_set('soap.wsdl_cache_enabled',0);
ini_set('soap.wsdl_cache_ttl',0);
$soap_server = new SoapServer('Notification.wsdl');
$soap_server->addFunction('Notify');
function Notify($message)
{
return array('message' => $message);
}
$soap_server->handle();
?>
这是我的客户端代码,这是引发错误的原因。端点是 https。wsdl 文件是本地的。
<?php
$context = stream_context_create(array(
'https' => array(
'cafile' => 'APX_WS_API1.cer',
'verify_peer' => true
)
));
$soap_client = new SoapClient('http://localhost:8888/Receiver/Notification.wsdl',
array('stream_context' => $context,'local_cer' => 'APX_WS_API1.cer'));
try{
$result = $soap_client->__soapCall('Notify',array('message' => 'Hello World'));
echo $result;
}catch(SoapFault $e){
echo "Error: " . $e->faultstring;
}
?>
有人可以告诉我我做错了什么。提前致谢