*/ class Mage_Api_Model_Server_V2_Adapter_Soap extends Mage_Api_Model_Server_Adapter_Soap { /** * Run webservice * * @param Mage_Api_Controller_Action $controller * @return Mage_Api_Model_Server_Adapter_Soap */ public function run() { $apiConfigCharset = Mage::getStoreConfig("api/config/charset"); if ($this->getController()->getRequest()->getParam('wsdl') !== null) { $wsdlConfig = Mage::getModel('api/wsdl_config'); $wsdlConfig->setHandler($this->getHandler()) ->init(); $this->getController()->getResponse() ->clearHeaders() ->setHeader('Content-Type','text/xml; charset='.$apiConfigCharset) ->setBody( preg_replace( '/<\?xml version="([^\"]+)"([^\>]+)>/i', '', $wsdlConfig->getWsdlContent() ) ); } else { try { $this->_instantiateServer(); $this->getController()->getResponse() ->clearHeaders() ->setHeader('Content-Type','text/xml; charset='.$apiConfigCharset) ->setBody( preg_replace( '/<\?xml version="([^\"]+)"([^\>]+)>/i', '', $this->_soap->handle() ) ); } catch( Zend_Soap_Server_Exception $e ) { $this->fault( $e->getCode(), $e->getMessage() ); } catch( Exception $e ) { $this->fault( $e->getCode(), $e->getMessage() ); } } return $this; } }