public function __call($name, $arguments) { $b = Kwf_Benchmark::start('soapCall', $name); $ret = parent::__call($name, $arguments); if ($b) { $b->stop(); } return $ret; }
/** * Perform a SOAP call * * @param string $name * @param array $arguments * @return mixed */ public function __call($name, $arguments) { /*$config = Zend_Registry::get('config'); $db = Zend_Db_Table::getDefaultAdapter(); $cm = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('soaplogger'); $write = new Zend_Log_Writer_Db($db, 'log.soap', $cm->getColumnMapping()); $cm->setWriter($write); $logger = $cm->getLogObject();*/ //$logger->setEventItem('method', $name); //$logger->setEventItem('params', serialize($arguments)); $soapInfo = array(); try { $result = parent::__call($name, $arguments); $soapInfo[] = ''; $soapInfo[] = $this->getLastMethod(); $soapInfo[] = $this->getLastRequestHeaders(); $soapInfo[] = $this->getLastResponseHeaders(); $soapInfo[] = $this->getLastRequest(); $soapInfo[] = $this->getLastResponse(); $soapInfoStr = implode("[zfdebug]", $soapInfo); $this->saveSoapDataInToFile($soapInfoStr); //$logger->setEventItem('result', json_encode($result)); /*if($config['webservice']['logxml']) { $logger->setEventItem('request', json_encode($this->getLastRequest())); $logger->setEventItem('response', json_encode($this->getLastResponse())); }*/ //$logger->log('Wykonano akcję '.$name,Zend_Log::INFO); return $result; } catch (Exception $e) { $soapInfo[] = ''; $soapInfo[] = $e->getMessage(); $soapInfoStr = implode("[zfdebug]", $soapInfo); $this->saveSoapDataInToFile($soapInfoStr); //$logger->setEventItem('result', $e->getMessage()); /*if($config['webservice']['logxml']) { $logger->setEventItem('request', json_encode($this->getLastRequest())); $logger->setEventItem('response', json_encode($this->getLastResponse())); }*/ //$logger->log('Wyjątek w akcji '.$name,Zend_Log::ERR); throw $e; } }
/** * Perform a SOAP call but first check for adding STS Token or fetch one * * @param string $name * @param array $arguments * @return mixed */ public function __call($name, $arguments) { /** * add WSSE Security header */ if ($this->_tokenService !== null) { // if login method we addWsseLoginHeader if (in_array('login', $arguments)) { $this->addWsseLoginHeader(); } elseif ($name == 'getTokens') { $this->addWsseTokenHeader($this->_tokenService->getLoginToken()); } else { $this->addWsseSecurityTokenHeader($this->_tokenService->getTokens()); } } return parent::__call($name, $arguments); }
/** * Execute test client WS request * * @param string $serverurl server url (including token parameter or username/password parameters) * @param string $function function name * @param array $params parameters of the called function * @return mixed */ public function simpletest($serverurl, $function, $params) { //zend expects 0 based array with numeric indexes $params = array_values($params); require_once 'Zend/Soap/Client.php'; $client = new Zend_Soap_Client($serverurl . '&wsdl=1'); return $client->__call($function, $params); }
/** * implements and performs the general soap request to Trusted Shops * * @param string $soapFunction * @param array $soapData * @param $shopId * @internal param $requestURLSuffix * @return string or int | soap resonse data */ private function sendSoapRequest($soapFunction, array $soapData = null, $shopId) { define('SOAP_ERROR', -1); $settings = $this->tsConfig->getSettings($shopId); $ts_url = $settings['trustedShopsTestSystem'] ? 'protection-qa.trustedshops.com' : 'protection.trustedshops.com'; //special url for protection request on save order $wsdlUrl = 'https://' . $ts_url . '/ts/protectionservices/ApplicationRequestService?wsdl'; try { $client = new \Zend_Soap_Client($wsdlUrl); $returnValue = $client->__call($soapFunction, $soapData); } catch (\SoapFault $fault) { $returnValue = $fault->faultcode . ' ' . $fault->faultstring; } return $returnValue; }
public function __call($name, $params) { return json_decode(parent::__call($name, $params), true); }
/** * Helper function which implements the general soap request to trusted shops * * @param \String $soapFunction * @param array $soapData * @internal param $requestURLSuffix * @return string or int | soap resonse data */ private function sendSoapRequest(String $soapFunction, Array $soapData = null) { define("SOAP_ERROR", -1); # TS-ID received by Trusted Shops $tsId = $this->pluginConfig->tsEID; if(empty($soapData)) { $soapData = array($tsId); } if($soapFunction == "requestForProtectionV2" || $soapFunction == "getRequestState" ) { $ts_url = ($this->pluginConfig->testSystemActive) ? self::TS_PROTECTION_QA_SERVER : self::TS_PROTECTION_SERVER; //special url for protection request on save order $wsdlUrl = "https://" . $ts_url . self::TS_PROTECTION_WSDL; } elseif ($soapFunction == "updateRatingWidgetState") { $ts_url = ($this->pluginConfig->testSystemActive) ? self::TS_QA_SERVER : self::TS_SERVER; $wsdlUrl = "https://" . $ts_url . self::TS_RATING_WSDL; } else { $ts_url = ($this->pluginConfig->testSystemActive) ? self::TS_QA_SERVER : self::TS_SERVER; $wsdlUrl = "https://" . $ts_url . self::TS_WSDL; } try { $client = new Zend_Soap_Client($wsdlUrl); $returnValue = $client->__call($soapFunction, $soapData); } catch(SoapFault $fault) { $returnValue = $fault->faultcode . " " . $fault->faultstring; } return $returnValue; }