2015-10-07 158 views
0

场景:通过SSL从本地主机到外部服务器的SOAP请求。Soapclient https请求

PHP版本:5.6.3

第一次尝试:

$options = array (
    'encoding'    => 'UTF-8', 
    'stream_context'  => stream_context_create(array(
     'ssl' => array(
       'verify_peer'  => false, 
       'verify_peer_name' => false, 
       'allow_self_signed' => true, 
      ) 
     ) 
    ), 
); 
$client = new SoapClient('https://www.???.es/index.php/api/soap?wsdl', $options); 

错误:SOAP的错误:解析WSDL

建议的解决方案发现here由tobik(做一个WDSL文件请求之前下载)

第二次尝试:

$filename = 'test.wsdl'; 
$uri = dirname(__FILE__) . DIRECTORY_SEPARATOR .$filename; 
$options = array (
    'encoding'    => 'UTF-8', 
    'location'    => 'https://www.???.es', 
    'uri'     => $uri, 
    'stream_context'  => stream_context_create(array(
     'ssl' => array(
       'verify_peer'  => false, 
       'verify_peer_name' => false, 
       'allow_self_signed' => true, 
       'cache_wsdl' => WSDL_CACHE_NONE, 
      ) 
     ) 
    ), 
); 
$client = new SoapClient(null, $options); 

错误:未捕获 异常的SOAPFault:[客户]看起来我们在...

回答

0

没有得到XML文档终于解决了添加

openssl.cafile=/etc/ssl/certs/ca-bundle.crt 

在php.ini中