Re: [SOAP] Can't connect to WSDL via https on PHP 5.5

[email protected] (Tobias Zatti) Fri, 10 Jan 2014 11:45:23 +0100
Newsgroups php.soap
Message-ID <[email protected]>
Am 09.01.2014 21:44, schrieb Richard Quadling:
> On 9 January 2014 16:21, Tobias Zatti <[email protected]> wrote:
>
>> Hi!
>>
>> I have written a small php library for some SOAP functions in a wsdl file
>> and it works perfectly with PHP 5.4.16.
>> However, with version 5.5 the connection won't work, I get the following
>> error:
>>
>> SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://
>> <myServer>/query.jws?WSDL' : failed to load external entity "https://
>> <myserver>/query.jws?WSDL"
>>
>> My old code looks like this:
>>
>> $this->soap = new SoapClient($this->getAPIURL(QUERY));
>> return $this->sendSOAP('hello', $params);
>>
>> and, as already said it works perfectly fine on PHP 5.4.
>>
>> Now I found that on version 5.5 there is a new option "ssl_method". It
>> looks like it has no effect whatsoever, because the result is always the
>> same, regardless which option I put. Also the default value is the same as
>> in PHP 5.4.
>> However, I changed my code to this but without success:
>>
>> try
>> {
>>    $this->soap = new SoapClient($this->getAPIURL(QUERY),
>>      array (
>>        "ssl_method" => "SOAP_SSL_METHOD_SSLv23"
>>      )
>>    );
>> }
>> catch (SoapFault $f)
>> {
>>    print $f->faultstring;
>> }
>>
>> I am using php 5.5.6 via XAMPP on my Windows machine.
>> Does anyone have any idea what I might do wrong? Or could it be a bug in
>> the newest PHP version?
>>
>> Thanks and best regards
>> Tobias
>>
>
> Can you add the trace and enable the exceptions.
>
> And with the catch, can just just var_dump($f) rather than just looking at
> the faultstring.
>
>
Hi,

with var_dump and trace the error looks like this:

#0 SymAPI->hello(Array ([Input] => it works!)) called at 
[C:\xampp2\htdocs\api\example.php:20] object(SoapFault)#3 (9) { 
["message":protected]=> string(190) "SOAP-ERROR: Parsing WSDL: Couldn't 
load from 'https://test-api.geotrust.com/webtrust/query.jws?WSDL' : 
failed to load external entity 
"https://test-api.geotrust.com/webtrust/query.jws?WSDL" " 
["string":"Exception":private]=> string(0) "" ["code":protected]=> 
int(0) ["file":protected]=> string(41) 
"C:\xampp2\htdocs\api\symantec_api-1.0.php" ["line":protected]=> 
int(483) ["trace":"Exception":private]=> array(2) { [0]=> array(6) { 
["file"]=> string(41) "C:\xampp2\htdocs\api\symantec_api-1.0.php" 
["line"]=> int(483) ["function"]=> string(10) "SoapClient" ["class"]=> 
string(10) "SoapClient" ["type"]=> string(2) "->" ["args"]=> array(2) { 
[0]=> string(53) "https://test-api.geotrust.com/webtrust/query.jws?WSDL" 
[1]=> array(1) { ["ssl_method"]=> string(21) "SOAP_SSL_METHOD_SSLv3" } } 
} [1]=> array(6) { ["file"]=> string(32) 
"C:\xampp2\htdocs\api\example.php" ["line"]=> int(20) ["function"]=> 
string(5) "hello" ["class"]=> string(6) "SymAPI" ["type"]=> string(2) 
"->" ["args"]=> array(1) { [0]=> &array(1) { ["Input"]=> string(9) "it 
works!" } } } } ["previous":"Exception":private]=> NULL 
["faultstring"]=> string(190) "SOAP-ERROR: Parsing WSDL: Couldn't load 
from 'https://test-api.geotrust.com/webtrust/query.jws?WSDL' : failed to 
load external entity 
"https://test-api.geotrust.com/webtrust/query.jws?WSDL" " 
["faultcode"]=> string(4) "WSDL" }
BACKTRACE:
#0 SymAPI->hello(Array ([Input] => it works!)) called at 
[C:\xampp2\htdocs\api\example.php:20]

I'm not sure how to enable exceptions, and I couldn't find anything 
specific googling.
I think the var dump doesn't help that much. But I know that the wsdl is 
based on WebLogic and supports SSLv3 and TLS1.0, so it should work with 
the SOAP_SSL_METHOD_SSLv3 setting.