保持越來越無法連接到主機,這是服務器端的代碼,我有的Https web服務的PHP
<?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;
}
?>
有人能告訴我我做錯了什麼。在此先感謝
'新的SoapClient('http:// loc..' =>'新的SoapClient('https:// loc..'。給與上下文只是https選項並不意味着任何東西,當它不是它的傳輸時 – Wrikken
謝謝對於快速響應,我現在收到致命錯誤:未捕獲SoapFault異常:[WSDL] SOAP-ERROR:解析WSDL:無法從「https:// localhost:8888/Receiver/Notification.wsdl」加載:未能在C:\ wamp \ www \ Receiver \ soap_client.php中加載外部實體「https:// localhost:8888/Receiver/Notification.wsdl」:13 Stack trace:#0 C:\ wamp \ www \ Receiver \ soap_client.php (13):第13行中的C:\ wamp \ www \ Receiver \ soap_client.php中拋出的SoapClient-> SoapClient('https:// localho ...',Array)#1 {main} –