PHP SoapClient是否支持HTTPS连接 [英] Does PHP SoapClient support HTTPS connections

查看:775
本文介绍了PHP SoapClient是否支持HTTPS连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows上使用XAMPP并尝试使用PHP soap扩展SoapClient。我正在尝试使用以下代码加载HTTPS站点中托管的WSDL文件

 <?php 
$ myClient = new SoapClient(https://smi.sp.f-secure.com/smi/5.1/services/EchoService?wsdl);
?>

我收到以下错误:


致命错误:未捕获的SoapFault异常:[WSDL] SOAP-ERROR:解析WSDL:无法从'



我在使用php 5.6的Windows上遇到了同样的麻烦,它在Linux上使用php 5.6工作正常。



你可以使用函数 openssl_get_cert_locations 以查看证书位置。



到目前为止,我无法找到解决方案。


I'm using XAMPP on Windows and try to work with PHP soap extension SoapClient. I'm trying to load a WSDL file hosted in HTTPS site using the following code

<?php
    $myClient=new SoapClient("https://smi.sp.f-secure.com/smi/5.1/services/EchoService?wsdl");
?>

I get the following error:

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://smi.sp.f-secure.com/smi/5.1/services/EchoService?wsdl' : failed to load external entity "https://smi.sp.f-secure.com/smi/5.1/services/EchoService?wsdl" in C:\xampp\htdocs\dev\w3schools\soapClient\index.php:2 Stack trace:
#0 C:\xampp\htdocs\dev\w3schools\soapClient\index.php(2): SoapClient->SoapClient('https://smi.sp....')
#1 {main} thrown in C:\xampp\htdocs\dev\w3schools\soapClient\index.php on line 2

Now I took a network capture during the request and saw that HTTPS communication does not work OK on SSL Level. Wireshark shows a packet on Server Key Exchange my workstation responds with:

TLSv1 Record Layer: Alert (Level: Fatal, Description: Certificate Unknown)

Using nuSOAP client or soapUI utility from the same computer, I'm able to connect to the service normally. So no certificate problems I guess.

So definately it's something with SOAP extension and SSL communication. Can anyone help? Give hints what to look for?

解决方案

it has to do with this change in php 5.6: http://php.net/manual/en/migration56.openssl.php

I have the same trouble on Windows with php 5.6 and it works fine on Linux with php 5.6.

You can use the function openssl_get_cert_locations to see what are the certificate locations.

So far I wasn't able to find a solution.

这篇关于PHP SoapClient是否支持HTTPS连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆