public function executeSoap() { if (!stWebApi::isEnabled()) { $i18n = $this->getContext()->getI18N(); $this->setFlash('error', $i18n->__('Musisz włączyć webapi', null, 'stWebApiBackend'), false); $this->getResponse()->setStatusCode(503); return $this->forward('stWebApiBackend', 'config'); } $config = stConfig::getInstance('stWebApiBackend'); if ($config->get('ssl', false) && !$this->getRequest()->isSecure()) throw new SoapFault('SSL', 'Please try via SSL.'); $this->setLayout(false); $response = $this->getResponse(); $response->setContentType( "text/xml" ); if ($this->hasRequestParameter('wsdl')) { return $this->renderText(trim($this->getRenderPartial('webapi_wsdl'))); } else { ini_set("soap.wsdl_cache_enabled",0); $WSDLFile = $this->getController()->genUrl('getModuleName() ?>/soap', true); $soap = new SoapServer($WSDLFile.'?wsdl'); $soap->setClass( "getModuleName() ?>WebApi"); ob_start(); $soap->handle(); return $this->renderText(ob_get_clean()); } }