WAMP SOAP SSL Certificate (PEM) Failed to load external entity
ik kom er zelf niet uit, heb al vanalles geprobeerd.
Ik probeer een SoapClient te gebruiken in een PHP script. Op mijn WAMP lokaal krijg ik deze melding:
Code (php)
1
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://cxxxx.cxxx.nl/sssss/webservices/transfer.asmx?WSDL' : failed to load external entity "https://cxxxx.cxxx.nl/sssss/webservices/transfer.asmx?WSDL" in C:\wamp\www\test\index.php:108 Stack trace: #0 C:\wamp\www\test\index.php(108): SoapClient->SoapClient('https://cxxxx...', Array) #1 {main} thrown in C:\wamp\www\test\index.php on line 108
Met deze aanroep:
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
$context = stream_context_create(array(
'ssl' => array(
'verify_peer' => false,
'allow_self_signed' => true,
'local_cert' => $certificate,
'passphrase' => '111111'
),
'https' => array(
'curl_verify_ssl_peer' => false,
'curl_verify_ssl_host' => false
)
));
//define the soap client object
$client = new SoapClient($wsdl, array(
'passphrase' => "11111",
"trace"=>true,
"stream_context" => $context,
"exceptions"=>true,
"local_cert" => $certificate //parameter for certificate authentication
));
'ssl' => array(
'verify_peer' => false,
'allow_self_signed' => true,
'local_cert' => $certificate,
'passphrase' => '111111'
),
'https' => array(
'curl_verify_ssl_peer' => false,
'curl_verify_ssl_host' => false
)
));
//define the soap client object
$client = new SoapClient($wsdl, array(
'passphrase' => "11111",
"trace"=>true,
"stream_context" => $context,
"exceptions"=>true,
"local_cert" => $certificate //parameter for certificate authentication
));
Hetzelfde script op de productie server werkt wel goed...
Deze functie werkt lokaal ook en krijg dan de XML van de WSDL terug.
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
function url_get_contents ($url, $cert) {
if (function_exists('curl_exec')){
$conn = curl_init($url);
curl_setopt($conn, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($conn, CURLOPT_FRESH_CONNECT, true);
curl_setopt($conn, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($conn, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($conn, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt ($conn, CURLOPT_SSLCERT, $cert);
curl_setopt ($conn, CURLOPT_SSLCERTPASSWD, "111111");
$url_get_contents_data = (curl_exec($conn));
curl_close($conn);
}elseif(function_exists('file_get_contents')){
$url_get_contents_data = file_get_contents($url);
}elseif(function_exists('fopen') && function_exists('stream_get_contents')){
$handle = fopen ($url, "r");
$url_get_contents_data = stream_get_contents($handle);
}else{
$url_get_contents_data = false;
}
return $url_get_contents_data;
}
if (function_exists('curl_exec')){
$conn = curl_init($url);
curl_setopt($conn, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($conn, CURLOPT_FRESH_CONNECT, true);
curl_setopt($conn, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($conn, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($conn, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt ($conn, CURLOPT_SSLCERT, $cert);
curl_setopt ($conn, CURLOPT_SSLCERTPASSWD, "111111");
$url_get_contents_data = (curl_exec($conn));
curl_close($conn);
}elseif(function_exists('file_get_contents')){
$url_get_contents_data = file_get_contents($url);
}elseif(function_exists('fopen') && function_exists('stream_get_contents')){
$handle = fopen ($url, "r");
$url_get_contents_data = stream_get_contents($handle);
}else{
$url_get_contents_data = false;
}
return $url_get_contents_data;
}
De fout treed op bij het aanroepen van de constructor van de SOAP client. Als ik de WSDL in een file opsla en die gebruik in de aanroep werkt het wel (alleen werkt dan de rest van de code niet meer omdat de functies dan niet gevonden worden) .
Weet iemand hier iets meer over en heeft nog suggesties?
Er zijn nog geen reacties op dit bericht.