예제 #1
0
 public function testMultipleAttempt()
 {
     $this->soapClientMock->expects($this->at(0))->method('__getLastResponseHeaders')->will($this->returnValue("HTTP/1.1 502 Bad gateway\n\r"));
     $this->soapClientMock->expects($this->at(0))->method('__soapCall')->will($this->throwException(new \Exception('error', 502)));
     $this->soapClientMock->expects($this->at(1))->method('__getLastResponseHeaders')->will($this->returnValue("HTTP/1.1 503 Service unavailable Explained\n\r"));
     $this->soapClientMock->expects($this->at(1))->method('__soapCall')->will($this->throwException(new \Exception('error', 503)));
     $this->soapClientMock->expects($this->at(2))->method('__getLastResponseHeaders')->will($this->returnValue("HTTP/1.1 504 Gateway timeout Explained\n\r"));
     $this->soapClientMock->expects($this->at(2))->method('__soapCall')->will($this->throwException(new \Exception('error', 504)));
     $this->soapClientMock->expects($this->at(4))->method('__getLastResponseHeaders')->will($this->returnValue("HTTP/1.1 200 OK\n\r"));
     $this->soapClientMock->expects($this->at(4))->method('__soapCall');
     $this->transport->expects($this->once())->method('getSoapClient')->will($this->returnValue($this->soapClientMock));
     $this->settings->set('wsdl_url', 'http://localhost.not.exists/?wsdl');
     $this->transport->init($this->transportEntity);
     $this->transport->call('test');
 }
예제 #2
0
 /**
  * {@inheritdoc}
  */
 public function call($action, $params = [])
 {
     if (null !== $this->sessionId) {
         $params = array_merge(['sessionId' => $this->sessionId], (array) $params);
     }
     if ($this->logger) {
         $this->logger->debug(sprintf('[%.1fMB/%.1fMB] Call %s action with %s parameters', memory_get_usage() / 1024 / 1024, memory_get_peak_usage() / 1024 / 1024, $action, json_encode($params)));
     }
     if ($this->isWsiMode) {
         $result = parent::call($action, [(object) $params]);
         $result = WSIUtils::parseWSIResponse($result);
     } else {
         $result = parent::call($action, $params);
     }
     $this->lookUpForServerTime();
     return $result;
 }
예제 #3
0
 /**
  * {@inheritdoc}
  */
 public function call($action, $params = [])
 {
     if (null !== $this->sessionId) {
         $params = array_merge(['sessionId' => $this->sessionId], (array) $params);
     }
     if ($this->isWsiMode) {
         $result = parent::call($action, [(object) $params]);
         $result = WSIUtils::parseWSIResponse($result);
     } else {
         $result = parent::call($action, $params);
     }
     $this->lookUpForServerTime();
     return $result;
 }