/**
  * Triggers the SOAP request over HTTP.
  * Sent request by cURL instead of native SOAP request.
  *
  * @param string      $request
  * @param string      $location
  * @param string      $action
  * @param int         $version
  * @param string|null $one_way
  *
  * @return string The XML SOAP response.
  * @throws WsClientException
  * @throws NoServerAvailableException
  * @throws \InvalidArgumentException
  * @throws \SoapFault
  */
 public function __doRequest($request, $location, $action, $version, $one_way = null)
 {
     $active = $this->manager->getActiveEndpoint();
     try {
         $response = $this->doHttpRequest($request, (string) $active->getUri(), $action);
         $this->manager->updateLastConnected();
         return $response;
     } catch (ConnectException $exception) {
         $active->setStatus('error');
         $this->log('Endpoint is not responding', 'error', ['endpoint' => $active]);
         return $this->__doRequest($request, $location, $action, $version, $one_way);
     }
 }
Esempio n. 2
0
 /**
  * Test if endpoint last connected is updated
  *
  * @throws InputException
  * @throws NoServerAvailableException
  */
 public function testUpdateEndpoint()
 {
     $manager = new Manager();
     /** @var Endpoint[] $endpoints */
     $endpoints = FactoryMuffin::seed(3, 'WebservicesNl\\Common\\Endpoint\\Endpoint');
     foreach ($endpoints as $endpoint) {
         $manager->addEndpoint($endpoint);
     }
     $endpoint = $manager->updateLastConnected();
     $dateTime = new \DateTime();
     self::assertInstanceOf('\\DateTime', $manager->getActiveEndpoint()->getLastConnected());
     self::assertEquals($dateTime, $endpoint->getLastConnected(), 'DateTimes should be close to each other', 5);
 }