Magento Certified Developer GuideCategory: 11. APIHow is the final WSDL composed? How can it be customized
Manish Prakash Staff asked 5 years ago

WSDL file is available in soap v2 api and the adapter file for SOAP V2 is ‘api/server_v2_adapter_soap’

In this we have the run() function which check api url has been called without any parameters, then it generates the wsdl output.

if ($this->getController()->getRequest()->getParam('wsdl') !== null) {
            $wsdlConfig = Mage::getModel('api/wsdl_config');
                ->setHeader('Content-Type','text/xml; charset='.$apiConfigCharset)
                        '/<\?xml version="([^\"]+)"([^\>]+)>/i',
                        '<?xml version="$1" encoding="'.$apiConfigCharset.'"?>',

In the model file ‘api/wsdl_config’ init() function , magento reads all wsdl.xml files from different modules and merges then to generate the final output.

             * Exclude Mage_Api wsdl xml file because it used for previous version
             * of API wsdl declaration
            $mergeWsdl->addLoadedFile(Mage::getConfig()->getModuleDir('etc', "Mage_Api").DS.'wsdl.xml');

            $baseWsdlFile = Mage::getConfig()->getModuleDir('etc', "Mage_Api").DS.'wsdl2.xml';
            Mage::getConfig()->loadModulesConfiguration('wsdl.xml', $this, $mergeWsdl);

In this code the wsdl.xml file is ignored and wsdl2.xml file is read as the base file.