简体   繁体   English

PHP SOAP无法连接到SSL WSDL源

[英]PHP SOAP cannot connect to an SSL WSDL source

Trying to make Soap connection to a https:// WSDL source via PHP/Win32, but keep getting the error: 尝试通过PHP / Win32与https:// WSDL源建立Soap连接,但不断收到错误:

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->faultstring property 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. 经过一些谷歌搜索,似乎PHP SOAP无法连接到HTTPS源。 HTTP is OK, though. 但是HTTP没问题。

Is there a workaround for this? 这有解决方法吗? Or is there an alternative SOAP version/module I can install? 或者我可以安装另一个SOAP版本/模块吗?

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库以支持安全事务。

  1. Uncomment extension=php_soap.dll in your php.ini 在php.ini中取消注释extension = php_soap.dll

  2. Uncomment extension=php_openssl.dll in your php.ini 在php.ini中取消注释extension = php_openssl.dll

  3. Copy ssleay32.dll and libeay32.dll to your windows system32 directory 将ssleay32.dll和libeay32.dll复制到您的windows system32目录

  4. Reboot apache, et voila! 重启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/

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. 事实证明它在CLI模式下工作。 Thus php_sapi = CLI. 因此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. 由于我们几乎总是将我们的webservices调用作为cronjob,Windows中的计划任务运行,这并不是一件坏事。 I was really glad to get it working! 我真的很高兴让它工作!

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. 更新:好的,当PHP作为Apache模块运行时,它使用了来自Apache安装的by opensll所需的库libeay32.dll和ssleay32.dll。 When using PHP in CLI is uses the libraries from the PHP directory/install. 在CLI中使用PHP时,使用PHP目录/ install中的库。 Overwriting the 2 Apache dlls with the dlls from the PHP directory did the trick. 用PHP目录中的dll覆盖2个Apache dll就可以了。 It now also runs under Apache. 它现在也在Apache下运行。 So your PHP version should match with the working dlls for the specific version. 所以你的PHP版本应该与特定版本的工作dll相匹配。 When it still doesn't work in the web interface. 当它仍然无法在Web界面中工作。 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. 请检查Apache是​​否没有从系统定义路径中先前指定的Windows系统目录加载这些dll,该目录由Apache选取。

I've had success with SSL and SOAP using NuSOAP: 我使用NuSOAP成功使用SSL和SOAP:

http://nusoap.sourceforge.net/ http://nusoap.sourceforge.net/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM