web/lib/Zend/Soap/Wsdl.php
changeset 1230 68c69c656a2c
parent 807 877f952ae2bd
equal deleted inserted replaced
1229:5a6b6e770365 1230:68c69c656a2c
    12  * obtain it through the world-wide-web, please send an email
    12  * obtain it through the world-wide-web, please send an email
    13  * to license@zend.com so we can send you a copy immediately.
    13  * to license@zend.com so we can send you a copy immediately.
    14  *
    14  *
    15  * @category   Zend
    15  * @category   Zend
    16  * @package    Zend_Soap
    16  * @package    Zend_Soap
    17  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    17  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
    18  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    18  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    19  * @version    $Id: Wsdl.php 25033 2012-08-17 19:50:08Z matthew $
    19  * @version    $Id$
    20  */
    20  */
    21 
    21 
    22 /**
    22 /**
    23  * @see Zend_Soap_Wsdl_Strategy_Interface
    23  * @see Zend_Soap_Wsdl_Strategy_Interface
    24  */
    24  */
    26 
    26 
    27 /**
    27 /**
    28  * @see Zend_Soap_Wsdl_Strategy_Abstract
    28  * @see Zend_Soap_Wsdl_Strategy_Abstract
    29  */
    29  */
    30 require_once "Zend/Soap/Wsdl/Strategy/Abstract.php";
    30 require_once "Zend/Soap/Wsdl/Strategy/Abstract.php";
       
    31 
       
    32 /** @see Zend_Xml_Security */
       
    33 require_once "Zend/Xml/Security.php";
    31 
    34 
    32 /**
    35 /**
    33  * Zend_Soap_Wsdl
    36  * Zend_Soap_Wsdl
    34  *
    37  *
    35  * @category   Zend
    38  * @category   Zend
    94                     xmlns:tns='$uri'
    97                     xmlns:tns='$uri'
    95                     xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
    98                     xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
    96                     xmlns:xsd='http://www.w3.org/2001/XMLSchema'
    99                     xmlns:xsd='http://www.w3.org/2001/XMLSchema'
    97                     xmlns:soap-enc='http://schemas.xmlsoap.org/soap/encoding/'
   100                     xmlns:soap-enc='http://schemas.xmlsoap.org/soap/encoding/'
    98                     xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'></definitions>";
   101                     xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'></definitions>";
    99         libxml_disable_entity_loader(true);
       
   100         $this->_dom = new DOMDocument();
   102         $this->_dom = new DOMDocument();
   101         if (!$this->_dom->loadXML($wsdl)) {
   103         if (!$this->_dom = Zend_Xml_Security::scan($wsdl, $this->_dom)) {
   102             require_once 'Zend/Server/Exception.php';
   104             require_once 'Zend/Server/Exception.php';
   103             throw new Zend_Server_Exception('Unable to create DomDocument');
   105             throw new Zend_Server_Exception('Unable to create DomDocument');
   104         } else {
   106         } 
   105             foreach ($this->_dom->childNodes as $child) {
   107         $this->_wsdl = $this->_dom->documentElement;
   106                 if ($child->nodeType === XML_DOCUMENT_TYPE_NODE) {
       
   107                     require_once 'Zend/Server/Exception.php';
       
   108                     throw new Zend_Server_Exception(
       
   109                         'Invalid XML: Detected use of illegal DOCTYPE'
       
   110                     );
       
   111                 }
       
   112             }
       
   113             $this->_wsdl = $this->_dom->documentElement;
       
   114         }
       
   115         libxml_disable_entity_loader(false);
       
   116 
   108 
   117         $this->setComplexTypeStrategy($strategy);
   109         $this->setComplexTypeStrategy($strategy);
   118     }
   110     }
   119 
   111 
   120     /**
   112     /**
   133 
   125 
   134         if($this->_dom !== null) {
   126         if($this->_dom !== null) {
   135             // @todo: This is the worst hack ever, but its needed due to design and non BC issues of WSDL generation
   127             // @todo: This is the worst hack ever, but its needed due to design and non BC issues of WSDL generation
   136             $xml = $this->_dom->saveXML();
   128             $xml = $this->_dom->saveXML();
   137             $xml = str_replace($oldUri, $uri, $xml);
   129             $xml = str_replace($oldUri, $uri, $xml);
   138             libxml_disable_entity_loader(true);
       
   139             $this->_dom = new DOMDocument();
   130             $this->_dom = new DOMDocument();
   140             $this->_dom->loadXML($xml);
   131             $this->_dom = Zend_Xml_Security::scan($xml, $this->_dom);
   141             libxml_disable_entity_loader(false);
       
   142         }
   132         }
   143 
   133 
   144         return $this;
   134         return $this;
   145     }
   135     }
   146 
   136