/**
  * 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;
 }
 /**
  * Prepares the soapCall.
  *
  * @param string     $function_name
  * @param array      $arguments
  * @param array      $options
  * @param array      $input_headers
  * @param array|null $output_headers
  *
  * @return mixed
  * @throws \Exception|\SoapFault
  */
 public function __soapCall($function_name, $arguments = [], $options = [], $input_headers = [], &$output_headers = null)
 {
     $this->log('Called:' . $function_name, LogLevel::INFO, ['arguments' => $arguments]);
     try {
         return parent::__soapCall($function_name, $arguments, $options, $input_headers, $output_headers);
     } catch (\SoapFault $fault) {
         if ($this->getConverter() !== null) {
             throw $this->getConverter()->convertToException($fault);
         }
         throw $fault;
     }
 }
 /**
  * @expectedException \SoapFault
  *
  * @throws \Exception
  * @throws \InvalidArgumentException
  * @throws \WebservicesNl\Common\Exception\Server\NoServerAvailableException
  * @throws \WebservicesNl\Common\Exception\Client\InputException
  * @throws \SoapFault
  */
 public function testSoapClientInstanceWithBadRequest()
 {
     $mock = new MockHandler([new Response(202, ['Content-Length' => 0])]);
     $handler = HandlerStack::create($mock);
     $curlClient = new Client(['handler' => $handler, 'exceptions' => false]);
     $instance = new SoapClient($this->settings, $this->manager, $curlClient);
     $instance->setLogger($this->logger);
     $instance->__soapCall('/login');
 }