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-2010 Zend Technologies USA Inc. (http://www.zend.com) |
17 * @copyright Copyright (c) 2005-2012 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 23342 2010-11-15 15:29:20Z alexander $ |
19 * @version $Id: Wsdl.php 25033 2012-08-17 19:50:08Z matthew $ |
20 */ |
20 */ |
21 |
21 |
22 /** |
22 /** |
23 * @see Zend_Soap_Wsdl_Strategy_Interface |
23 * @see Zend_Soap_Wsdl_Strategy_Interface |
24 */ |
24 */ |
94 xmlns:tns='$uri' |
94 xmlns:tns='$uri' |
95 xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' |
95 xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' |
96 xmlns:xsd='http://www.w3.org/2001/XMLSchema' |
96 xmlns:xsd='http://www.w3.org/2001/XMLSchema' |
97 xmlns:soap-enc='http://schemas.xmlsoap.org/soap/encoding/' |
97 xmlns:soap-enc='http://schemas.xmlsoap.org/soap/encoding/' |
98 xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'></definitions>"; |
98 xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'></definitions>"; |
|
99 libxml_disable_entity_loader(true); |
99 $this->_dom = new DOMDocument(); |
100 $this->_dom = new DOMDocument(); |
100 if (!$this->_dom->loadXML($wsdl)) { |
101 if (!$this->_dom->loadXML($wsdl)) { |
101 require_once 'Zend/Server/Exception.php'; |
102 require_once 'Zend/Server/Exception.php'; |
102 throw new Zend_Server_Exception('Unable to create DomDocument'); |
103 throw new Zend_Server_Exception('Unable to create DomDocument'); |
103 } else { |
104 } else { |
|
105 foreach ($this->_dom->childNodes as $child) { |
|
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 } |
104 $this->_wsdl = $this->_dom->documentElement; |
113 $this->_wsdl = $this->_dom->documentElement; |
105 } |
114 } |
|
115 libxml_disable_entity_loader(false); |
106 |
116 |
107 $this->setComplexTypeStrategy($strategy); |
117 $this->setComplexTypeStrategy($strategy); |
108 } |
118 } |
109 |
119 |
110 /** |
120 /** |
123 |
133 |
124 if($this->_dom !== null) { |
134 if($this->_dom !== null) { |
125 // @todo: This is the worst hack ever, but its needed due to design and non BC issues of WSDL generation |
135 // @todo: This is the worst hack ever, but its needed due to design and non BC issues of WSDL generation |
126 $xml = $this->_dom->saveXML(); |
136 $xml = $this->_dom->saveXML(); |
127 $xml = str_replace($oldUri, $uri, $xml); |
137 $xml = str_replace($oldUri, $uri, $xml); |
|
138 libxml_disable_entity_loader(true); |
128 $this->_dom = new DOMDocument(); |
139 $this->_dom = new DOMDocument(); |
129 $this->_dom->loadXML($xml); |
140 $this->_dom->loadXML($xml); |
|
141 libxml_disable_entity_loader(false); |
130 } |
142 } |
131 |
143 |
132 return $this; |
144 return $this; |
133 } |
145 } |
134 |
146 |
541 { |
553 { |
542 switch (strtolower($type)) { |
554 switch (strtolower($type)) { |
543 case 'string': |
555 case 'string': |
544 case 'str': |
556 case 'str': |
545 return 'xsd:string'; |
557 return 'xsd:string'; |
546 break; |
558 case 'long': |
|
559 return 'xsd:long'; |
547 case 'int': |
560 case 'int': |
548 case 'integer': |
561 case 'integer': |
549 return 'xsd:int'; |
562 return 'xsd:int'; |
550 break; |
|
551 case 'float': |
563 case 'float': |
|
564 return 'xsd:float'; |
552 case 'double': |
565 case 'double': |
553 return 'xsd:float'; |
566 return 'xsd:double'; |
554 break; |
|
555 case 'boolean': |
567 case 'boolean': |
556 case 'bool': |
568 case 'bool': |
557 return 'xsd:boolean'; |
569 return 'xsd:boolean'; |
558 break; |
|
559 case 'array': |
570 case 'array': |
560 return 'soap-enc:Array'; |
571 return 'soap-enc:Array'; |
561 break; |
|
562 case 'object': |
572 case 'object': |
563 return 'xsd:struct'; |
573 return 'xsd:struct'; |
564 break; |
|
565 case 'mixed': |
574 case 'mixed': |
566 return 'xsd:anyType'; |
575 return 'xsd:anyType'; |
567 break; |
|
568 case 'void': |
576 case 'void': |
569 return ''; |
577 return ''; |
570 default: |
578 default: |
571 // delegate retrieval of complex type to current strategy |
579 // delegate retrieval of complex type to current strategy |
572 return $this->addComplexType($type); |
580 return $this->addComplexType($type); |