SOAP-ERROR: Parsing WSDL: Couldn't load from u

2019-07-12 02:08发布

While executing the following line I get this error:

$client = new soapclient('https://example.com/xxx/pgw?wsdl=xyz.wsdl');

Error:

SoapFault: SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://localhost:8080/xxx/pgw?wsdl=xyz.wsdl' : failed to load external entity "http://localhost:8080/xxx/pgw?wsdl=xyz.wsdl" in SoapClient->SoapClient() (line 39 of /var/www/.../myscript.php).

I have checked the URL in my browser and that's ok. What can cause the error?

标签: php soap ssl
1条回答
贼婆χ
2楼-- · 2019-07-12 02:58

I ran across this same issue today, after several hours and after trying file_get_contents on my WSDL URL, I noticed that I was getting a permission denied error in my apache error log. I figured out that SELinux was the culprit. I believe by default, SELinux blocks httpd from making its own network requests (at least on Fedora).

The fix was: setsebool -P httpd_can_network_connect 1, which then allowed Apache to connect to the remote service (it worked for both SSL and non-SSL requests).

查看更多
登录 后发表回答