/**
  * Creates a SoapClient with configured SoapConfig object and given additional settings.
  *
  * @param array $settings additional settings go here
  *
  * @return SoapClient
  * @throws InputException
  * @throws NoServerAvailableException
  * @throws \InvalidArgumentException
  */
 public function create(array $settings = [])
 {
     // create soap settings, with given settings and platform settings
     $soapSettings = SoapSettings::loadFromArray($settings);
     // create a manager for endpoint management
     $manager = $this->createEndpointManager($settings);
     // replace the native soap client transport with a curl client
     $curlClient = $this->createCurlClient($soapSettings->toArray(), $manager);
     // build a SoapClient (extends the native soap client)
     $soapClient = new SoapClient($soapSettings, $manager, $curlClient);
     // set custom headers
     $soapHeaders = array_key_exists('soapHeaders', $settings) ? array_merge($settings['soapHeaders'], $this->config->getSoapHeaders()) : $this->config->getSoapHeaders();
     $soapClient->__setSoapHeaders($soapHeaders);
     if ($this->config->hasConverter() === true) {
         $soapClient->setConverter($this->config->getConverter());
     }
     if ($this->hasLogger() === true) {
         $soapClient->setLogger($this->logger);
         $this->logger->info('Created SoapClient for ' . $this->config->getPlatformConfig()->getPlatformName());
         $this->logger->debug('Created SoapClient', ['SoapClient' => print_r($soapClient, true)]);
         $this->logger->debug('Settings', ['settings' => (array) $settings]);
     }
     return $soapClient;
 }
 /**
  * @expectedException \WebservicesNl\Common\Exception\ServerException
  *
  * @throws \Exception
  * @throws \InvalidArgumentException
  * @throws \WebservicesNl\Common\Exception\Server\NoServerAvailableException
  * @throws \WebservicesNl\Common\Exception\Client\InputException
  * @throws \SoapFault
  */
 public function testSoapClientInstanceWithErrorResponseAndExceptionsAreConverted()
 {
     // Create a mock and queue successful response.
     $mock = new MockHandler([new Response(400, ['Content-Length' => 2000], "<?xml version='1.0'><broken><xml></broken>")]);
     $handler = HandlerStack::create($mock);
     $curlClient = new Client(['handler' => $handler, 'exceptions' => true]);
     $instance = new SoapClient($this->settings, $this->manager, $curlClient);
     $instance->setConverter(new Converter());
     $instance->setLogger($this->logger);
     $instance->__soapCall('login');
 }