SOAP-ERROR:解析WSDL:无法加载 - XAMPP

时间:2016-01-05 10:29:20

标签: php soap wsdl xampp

我收到错误:

  

SOAP-ERROR:解析WSDL:无法加载   ' https://apphom.correios.com.br/SigepMasterJPA/AtendeClienteService/AtendeCliente?wsdl'   :无法加载外部实体   " https://apphom.correios.com.br/SigepMasterJPA/AtendeClienteService/AtendeCliente?wsdl

我正在使用:

  • XAMPP for Windows 5.6.15 5.6.15
  • Windows 8.1
  • PHP版本5.6.15

在我的php.ini中,我启用了选项:

extension=php_openssl.dll
extension=php_curl.dll
extension=php_xmlrpc.dll

但是我无法解决这个错误,已经研究了几种解决方案。

我尝试运行的源代码是here

1 个答案:

答案 0 :(得分:0)

我通过重写我的方法解决了这个问题

public static function getSoapClient()
{
    if (!self::$_soapClient) {
        $wsdl = Bootstrap::getConfig()->getWsdlAtendeCliente();

        self::$_soapClient = new \SoapClient($wsdl, array(
            "trace"              => Bootstrap::getConfig()->getEnv() != Config::ENV_PRODUCTION,
            "exceptions"         => Bootstrap::getConfig()->getEnv() != Config::ENV_PRODUCTION,
            'encoding'           => self::WEB_SERVICE_CHARSET,
            'connection_timeout' => 60,
            'cache_wsdl'         => WSDL_CACHE_MEMORY,
        ));
    }

    return self::$_soapClient;
}

public static function getSoapClient()
{
    if (!self::$_soapClient) {
        $wsdl = Bootstrap::getConfig()->getWsdlAtendeCliente();

        $opts = array(
            'ssl' => array(
                'ciphers'           =>'RC4-SHA', 
                'verify_peer'       =>false, 
                'verify_peer_name'  =>false
            )
        );
        // SOAP 1.1 client
        $params = array (
            'encoding'              => self::WEB_SERVICE_CHARSET, 
            'verifypeer'            => false, 
            'verifyhost'            => false, 
            'soap_version'          => SOAP_1_1, 
            'trace'                 => Bootstrap::getConfig()->getEnv() != Config::ENV_PRODUCTION,
            'exceptions'            => Bootstrap::getConfig()->getEnv() != Config::ENV_PRODUCTION, 
            "connection_timeout"    => 180, 
            'stream_context'        => stream_context_create($opts) 
        );

        self::$_soapClient = new \SoapClient($wsdl, $params);
    }

    return self::$_soapClient;
}