PHP SOAP 无法连接到 SSL WSDL 源
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2001003/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
PHP SOAP cannot connect to an SSL WSDL source
提问by Anwar I
Trying to make Soap connection to a https:// WSDL source via PHP/Win32, but keep getting the error:
尝试通过 PHP/Win32 将 Soap 连接到 https:// WSDL 源,但不断收到错误消息:
Warning: SoapClient::SoapClient() [soapclient.soapclient]: I/O warning : failed to load external entity "https://...
警告:SoapClient::SoapClient() [soapclient.soapclient]:I/O 警告:无法加载外部实体“https://...
If I try to save the WSDL locally and access it then, the SoapFault->faultstringproperty has the message "SSL support is not available in this build".
如果我尝试在本地保存 WSDL 并随后访问它,则该SoapFault->faultstring属性会显示消息“此版本中不提供 SSL 支持”。
After some Googling, seems like PHP SOAP cannot connect to a HTTPS source. HTTP is OK, though.
经过一番谷歌搜索,似乎 PHP SOAP 无法连接到 HTTPS 源。不过,HTTP 没问题。
Is there a workaround for this? Or is there an alternative SOAP version/module I can install?
有解决方法吗?或者是否有我可以安装的替代 SOAP 版本/模块?
回答by AnotherLongUsername
HTTPS support for SOAP in PHP5
PHP5 中对 SOAP 的 HTTPS 支持
If you're seeing error messages about missing https wrappers when trying to use SOAP (”Unable to find the wrapper “https” – did you forget to enable it when you configured PHP?” or “[HTTP] SSL support is not available in this build”), you haven't installed the SSL libraries to support secure transactions.
如果您在尝试使用 SOAP 时看到有关缺少 https 包装器的错误消息(“无法找到包装器“https”——您在配置 PHP 时是否忘记启用它?”或“[HTTP] SSL 支持在此版本”),则您尚未安装 SSL 库来支持安全事务。
Uncomment extension=php_soap.dll in your php.ini
Uncomment extension=php_openssl.dll in your php.ini
Copy ssleay32.dll and libeay32.dll to your windows system32 directory
Reboot apache, et voila!
在 php.ini 中取消注释 extension=php_soap.dll
在 php.ini 中取消注释 extension=php_openssl.dll
将 ssleay32.dll 和 libeay32.dll 复制到你的 windows system32 目录
重新启动 apache,等等!
I originally found this answer at: http://webponce.com/rants/2008/04/https-support-for-soap-in-php5-under-windows/
我最初在以下位置找到了这个答案:http: //webponce.com/rants/2008/04/https-support-for-soap-in-php5-under-windows/
回答by Frank
I had the same problem. openSSL, cURL were enabled, initiated a SoapClient with option of location to stored certificated, etc, etc.. tried everything.
我有同样的问题。openSSL、cURL 已启用,启动了一个 SoapClient,可以选择存储证书等的位置,等等。尝试了一切。
Turns out it does work in CLI mode. Thus php_sapi = CLI. As we almost always run our webservices calls as a cronjob, scheduled task in Windows, this is not really a bad thing. I was really glad to get it working!
事实证明它确实在 CLI 模式下工作。因此 php_sapi = CLI。由于我们几乎总是将我们的网络服务调用作为 Windows 中的 cronjob 计划任务运行,这并不是一件坏事。我真的很高兴让它工作!
Update: Okay, turns out when PHP is running as an Apache module, it uses the by opensll required libraries libeay32.dll and ssleay32.dll from the Apache install. When using PHP in CLI is uses the libraries from the PHP directory/install. Overwriting the 2 Apache dlls with the dlls from the PHP directory did the trick. It now also runs under Apache. So your PHP version should match with the working dlls for the specific version. When it still doesn't work in the web interface. Please check that Apache isn't loading these dlls from a Windows System directory, specified earlier in your system defined path, which is picked up by Apache.
更新:好的,事实证明,当 PHP 作为 Apache 模块运行时,它使用来自 Apache 安装的 opensll 所需的库 libeay32.dll 和 ssleay32.dll。在 CLI 中使用 PHP 时,会使用 PHP 目录/安装中的库。用 PHP 目录中的 dll 覆盖 2 个 Apache dll 就成功了。它现在也在 Apache 下运行。所以你的 PHP 版本应该与特定版本的工作 dll 匹配。当它仍然无法在 Web 界面中工作时。请检查 Apache 是否没有从 Windows 系统目录中加载这些 dll,这些 dll 是之前在系统定义的路径中指定的,由 Apache 选择。
回答by leepowers
I've had success with SSL and SOAP using NuSOAP:
我使用 NuSOAP 在 SSL 和 SOAP 方面取得了成功:

