SOAP PHP fault parsing WSDL: failed to load external entity?

前端 未结 12 1907
耶瑟儿~
耶瑟儿~ 2020-11-27 05:37

I\'m trying to run a web service using PHP & SOAP, but all I\'m getting so far is this:

(SoapFault)[2] message which states: \'SOAP-ERROR: Parsing

12条回答
  •  没有蜡笔的小新
    2020-11-27 06:38

    After migrating to PHP 5.6.5, the soap 1.2 did not work anymore. So I solved the problem by adding optional SSL parameters.

    My error:

    failed to load external entity

    How to solve:

    // options for ssl in php 5.6.5
    $opts = array(
        'ssl' => array(
            'ciphers' => 'RC4-SHA',
            'verify_peer' => false,
            'verify_peer_name' => false
        )
    );
    
    // SOAP 1.2 client
    $params = array(
        'encoding' => 'UTF-8',
        'verifypeer' => false,
        'verifyhost' => false,
        'soap_version' => SOAP_1_2,
        'trace' => 1,
        'exceptions' => 1,
        'connection_timeout' => 180,
        'stream_context' => stream_context_create($opts)
    );
    
    $wsdlUrl = $url . '?WSDL';
    $oSoapClient = new SoapClient($wsdlUrl, $params);
    

提交回复
热议问题