Public Member Functions | |
setHandler ($handler) | |
getHandler () | |
setController (Mage_Api_Controller_Action $controller) | |
getController () | |
run () | |
fault ($code, $message) | |
Protected Member Functions | |
_extensionLoaded () | |
Protected Attributes | |
$_soap = null |
Definition at line 34 of file Soap.php.
_extensionLoaded | ( | ) | [protected] |
fault | ( | $ | code, | |
$ | message | |||
) |
Dispatch webservice fault
int | $code | |
string | $message |
Implements Mage_Api_Model_Server_Adapter_Interface.
Definition at line 145 of file Soap.php.
00146 { 00147 if ($this->_extensionLoaded()) { 00148 throw new SoapFault($code, $message); 00149 } else { 00150 die('<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> 00151 <SOAP-ENV:Body> 00152 <SOAP-ENV:Fault> 00153 <faultcode>' . $code . '</faultcode> 00154 <faultstring>' . $message . '</faultstring> 00155 </SOAP-ENV:Fault> 00156 </SOAP-ENV:Body> 00157 </SOAP-ENV:Envelope>'); 00158 } 00159 00160 }
getController | ( | ) |
Retrive webservice api controller
Implements Mage_Api_Model_Server_Adapter_Interface.
Definition at line 84 of file Soap.php.
00085 { 00086 return $this->getData('controller'); 00087 }
getHandler | ( | ) |
Retrive handler class name for webservice
Implements Mage_Api_Model_Server_Adapter_Interface.
Definition at line 62 of file Soap.php.
00063 { 00064 return $this->getData('handler'); 00065 }
run | ( | ) |
Run webservice
Mage_Api_Controller_Action | $controller |
Implements Mage_Api_Model_Server_Adapter_Interface.
Reimplemented in Mage_Api_Model_Server_V2_Adapter_Soap.
Definition at line 95 of file Soap.php.
00096 { 00097 $urlModel = Mage::getModel('core/url') 00098 ->setUseSession(false); 00099 if ($this->getController()->getRequest()->getParam('wsdl') !== null) { 00100 // Generating wsdl content from template 00101 $io = new Varien_Io_File(); 00102 $io->open(array('path'=>Mage::getModuleDir('etc', 'Mage_Api'))); 00103 00104 $wsdlContent = $io->read('wsdl.xml'); 00105 00106 $template = Mage::getModel('core/email_template_filter'); 00107 00108 $wsdlConfig = new Varien_Object(); 00109 $queryParams = $this->getController()->getRequest()->getQuery(); 00110 if (isset($queryParams['wsdl'])) { 00111 unset($queryParams['wsdl']); 00112 } 00113 00114 $wsdlConfig->setUrl( 00115 htmlspecialchars($urlModel->getUrl('*/*/*', array('_query'=>$queryParams))) 00116 ); 00117 $wsdlConfig->setName('Magento'); 00118 $wsdlConfig->setHandler($this->getHandler()); 00119 00120 $template->setVariables(array('wsdl'=>$wsdlConfig)); 00121 00122 $this->getController()->getResponse() 00123 ->setHeader('Content-Type','text/xml') 00124 ->setBody($template->filter($wsdlContent)); 00125 } elseif ($this->_extensionLoaded()) { 00126 $this->_soap = new SoapServer($urlModel->getUrl('*/*/*', array('wsdl'=>1))); 00127 use_soap_error_handler(false); 00128 $this->_soap->setClass($this->getHandler()); 00129 $this->getController()->getResponse() 00130 ->setHeader('Content-Type', 'text/xml') 00131 ->setBody($this->_soap->handle()); 00132 00133 } else { 00134 $this->fault('0', 'Unable to load Soap extension on the server'); 00135 } 00136 return $this; 00137 }
setController | ( | Mage_Api_Controller_Action $ | controller | ) |
Set webservice api controller
Mage_Api_Controller_Action | $controller |
Implements Mage_Api_Model_Server_Adapter_Interface.
Definition at line 73 of file Soap.php.
00074 { 00075 $this->setData('controller', $controller); 00076 return $this; 00077 }
setHandler | ( | $ | handler | ) |
Set handler class name for webservice
string | $handler |
Implements Mage_Api_Model_Server_Adapter_Interface.
Definition at line 51 of file Soap.php.
00052 { 00053 $this->setData('handler', $handler); 00054 return $this; 00055 }