Index: app/code/core/Mage/Api/etc/api.xml =================================================================== --- app/code/core/Mage/Api/etc/api.xml (revision 37105) +++ app/code/core/Mage/Api/etc/api.xml (working copy) @@ -69,6 +69,13 @@ + + + + http://schemas.xmlsoap.org/wsdl/ + + + 0 Index: app/code/core/Mage/Api/Model/Wsdl/Config.php =================================================================== --- app/code/core/Mage/Api/Model/Wsdl/Config.php (revision 37105) +++ app/code/core/Mage/Api/Model/Wsdl/Config.php (working copy) @@ -33,9 +33,8 @@ */ class Mage_Api_Model_Wsdl_Config extends Mage_Api_Model_Wsdl_Config_Base { + protected static $_namespacesPrefix = null; - protected $_wsdlContent = null; - public function __construct($sourceData=null) { $this->setCacheId('wsdl_config_global'); @@ -43,25 +42,30 @@ } /** - * Set content of wsdl file as string + * Return wsdl content * - * @param string $wsdlContent - * @return Mage_Api_Model_Wsdl_Config + * @return string */ - public function setWsdlContent($wsdlContent) + public function getWsdlContent() { - $this->_wsdlContent = $wsdlContent; - return $this; + return $this->_xml->asXML(); } /** - * Return wsdl content + * Return namespaces with their prefix * - * @return string + * @return array */ - public function getWsdlContent() + public static function getNamespacesPrefix() { - return $this->_wsdlContent; + if (is_null(self::$_namespacesPrefix)) { + self::$_namespacesPrefix = array(); + $config = Mage::getConfig()->getNode('api/v2/wsdl/prefix')->children(); + foreach ($config as $prefix => $namespace) { + self::$_namespacesPrefix[$namespace->asArray()] = $prefix; + } + } + return self::$_namespacesPrefix; } public function getCache() @@ -105,12 +109,6 @@ BP . DS . 'app' . DS . 'code' . DS . 'community' . PS . BP . DS . 'app' . DS . 'code' . DS . 'core' . PS . BP . DS . 'lib' . PS . - /** - * Problem with concatenate BP . $codeDir - */ - /*BP . $codeDir . DS .'community' . PS . - BP . $codeDir . DS .'core' . PS . - BP . $libDir . PS .*/ Mage::registry('original_include_path') ); } @@ -133,7 +131,6 @@ $this->loadFile($baseWsdlFile); foreach ($modules as $modName=>$module) { -// if ($module->is('active') && $modName == 'Mage_Customer') { if ($module->is('active') && $modName != 'Mage_Api') { if ($disableLocalModules && ('local' === (string)$module->codePool)) { continue; @@ -144,7 +141,6 @@ } } } - $this->setWsdlContent($this->_xml->asXML()); if (Mage::app()->useCache('config')) { $this->saveCache(array('config')); @@ -152,4 +148,14 @@ return $this; } + + /** + * Return Xml of node as string + * + * @return string + */ + public function getXmlString() + { + return $this->getNode()->asXML(); + } } Index: app/code/core/Mage/Api/Model/Wsdl/Config/Element.php =================================================================== --- app/code/core/Mage/Api/Model/Wsdl/Config/Element.php (revision 37105) +++ app/code/core/Mage/Api/Model/Wsdl/Config/Element.php (working copy) @@ -90,9 +90,13 @@ $targetChild->setParent($this); foreach ($this->getAttributes($source) as $namespace => $attributes) { foreach ($attributes as $key => $value) { + $_namespacesPrefix = Mage_Api_Model_Wsdl_Config::getNamespacesPrefix(); if ($namespace == '') { $namespace = null; + } elseif (array_key_exists($namespace, $_namespacesPrefix)) { + $key = $_namespacesPrefix[$namespace] . ':' . $key; } + $targetChild->addAttribute($key, $this->xmlentities($value), $namespace); } } @@ -109,8 +113,11 @@ $targetChild->setParent($this); foreach ($this->getAttributes($source) as $namespace => $attributes) { foreach ($attributes as $key => $value) { + $_namespacesPrefix = Mage_Api_Model_Wsdl_Config::getNamespacesPrefix(); if ($namespace == '') { $namespace = null; + } elseif (array_key_exists($namespace, $_namespacesPrefix)) { + $key = $_namespacesPrefix[$namespace] . ':' . $key; } $targetChild->addAttribute($key, $this->xmlentities($value), $namespace); } @@ -169,7 +176,6 @@ $children[''] = $source->children(''); foreach ($namespaces as $key => $value) { if ($key == '' || $key == 'wsdl') { - $value = ''; continue; } $children[$value] = $source->children($value); Index: lib/Varien/Simplexml/Config.php =================================================================== --- lib/Varien/Simplexml/Config.php (revision 37105) +++ lib/Varien/Simplexml/Config.php (working copy) @@ -413,7 +413,7 @@ $this->_saveCache($this->getCacheChecksum(), $this->getCacheChecksumId(), $tags, $this->getCacheLifetime()); } - $xmlString = $this->getNode()->asNiceXml('', false); + $xmlString = $this->getXmlString(); $this->_saveCache($xmlString, $this->getCacheId(), $tags, $this->getCacheLifetime()); $this->setCacheSaved(true); @@ -422,6 +422,16 @@ } /** + * Return Xml of node as string + * + * @return string + */ + public function getXmlString() + { + return $this->getNode()->asNiceXml('', false); + } + + /** * Enter description here... * * @return Varien_Simplexml_Config