2015-11-25 68 views
0

我無法連接到Web服務的問題,下面是我的代碼:CONNESSIONE web服務

$path = __DIR__; 
$wsdl = "https://wisetest.nobisassicurazioni.it/wisewebserviceptf/service.asmx?WSDL"; 
$urlC = $path."/wise-europeanbroker.vbnl6w.p12"; 

$soap_args = array(
    "login" => "europeanbrokers", 
    "password" => "xxxxxx", 
    "local_cert" => $urlC, 
    'user_agent' => 'PHPSoapClient', 
    "user_agent" => "PHP/SOAP", 
    "accept" => "application/xml", 
    "exceptions"=>true, 
    "trace" => true, 
    "http" => array('protocol_version' => '1.0')); 
try { 
    $context = stream_context_create($soap_args); 
    $client = new SoapClient($wsdl,array('stream_context' => $context)); 
    echo "Connection ok\n"; 

} catch (SoapFault $e) { 
    var_dump($e.message); 

} 

我認爲上面的代碼是確定的,但我總是得到如下錯誤:

string(428) "SoapFault exception: 
[WSDL] SOAP-ERROR: Parsing WSDL: 
Couldn't load from 'https://wisetest.nobisassicurazioni.it/wisewebserviceptf/service.asmx?WSDL' : 
failed to load external entity "https://wisetest.nobisassicurazioni.it/wisewebserviceptf/service.asmx?WSDL" 
in D:\siti\soap.test.local\SClient.php:40 
Stack trace: 
#0 D:\siti\soap.test.local\SClient.php(40): 
SoapClient->SoapClient('https://wisetes...', Array) 
#1 {main}message" 

什麼可能是問題?

+0

對我來說看起來像一個網絡問題。你可以嘗試在你的機器上訪問[WSDL的URL](https://wisetest.nobisassicurazioni.it/wisewebserviceptf/service.asmx?WSDL)並查看它是否加載? – FelisCatus

+0

貴公司是否強制執行代理?檢查您的瀏覽器或操作系統設置。你可能想更改密碼_now_ ;-) – Marged

+0

這是證書:它是自簽名的。除非您關閉證書驗證,否則SoapClient會默認拒絕它。參考[這個答案](http://stackoverflow.com/questions/8443618/disable-certificate-verification-in-php-soapclient)找出如何禁用「SoapClient」的證書驗證。 –

回答