src/Google/AdsApi/Common/AdsSoapClientFactory.php
public function generateSoapClient(
        AdsSession $session,
        AdsHeaderHandler $headerHandler,
        AdsServiceDescriptor $serviceDescriptor
    ) {
        $options = [
            'trace' => true,
            'encoding' => 'utf-8',
            'connection_timeout' => $this->soapCallTimeout,
            'features' => SOAP_SINGLE_ELEMENT_ARRAYS
        ];

        $soapSettings = $session->getSoapSettings();
        $options = $this->populateOptions($session, $options, $soapSettings);

        $soapClient = $this->reflection->createInstance(
            $serviceDescriptor->getServiceClass(),
            $options
        );
        $soapClient->setStreamContext($options['stream_context']);
        $soapClient->setSoapLogMessageFormatter($this->soapLogMessageFormatter);
        $soapClient->setAdsSession($session);
        $soapClient->setHeaderHandler($headerHandler);
        $soapClient->setServiceDescriptor($serviceDescriptor);
        $soapClient->setSoapCallTimeout($this->soapCallTimeout);
        $soapClient->__setLocation(
            str_replace(
                sprintf(
                    '%s://%s',
                    parse_url($soapClient->getWsdlUri(), PHP_URL_SCHEME),
                    parse_url($soapClient->getWsdlUri(), PHP_URL_HOST)
                ),
                rtrim($session->getEndpoint(), '/'),
                $soapClient->getWsdlUri()
            )
        );

        return $soapClient;
    }
public function generateSoapClient(
        AdsSession $session,
        AdsHeaderHandler $headerHandler,
        AdsServiceDescriptor $serviceDescriptor
    ) {
        $options = [
            'trace' => true,
            'encoding' => 'utf-8',
            'connection_timeout' => $this->soapCallTimeout,
            'features' => SOAP_SINGLE_ELEMENT_ARRAYS
        ];

        $soapSettings = $session->getSoapSettings();
        $options = $this->populateOptions($session, $options, $soapSettings);

        $soapClient = $this->reflection->createInstance(
            $serviceDescriptor->getServiceClass(),
            $options
        );
        $soapClient->setStreamContext($options['stream_context']);
        $soapClient->setSoapLogMessageFormatter($this->soapLogMessageFormatter);
        $soapClient->setAdsSession($session);
        $soapClient->setHeaderHandler($headerHandler);
        $soapClient->setServiceDescriptor($serviceDescriptor);
        $soapClient->setSoapCallTimeout($this->soapCallTimeout);
        $soapClient->__setLocation(
            str_replace(
                sprintf(
                    '%s://%s',
                    parse_url($soapClient->getWsdlUri(), PHP_URL_SCHEME),
                    parse_url($soapClient->getWsdlUri(), PHP_URL_HOST)
                ),
                rtrim($session->getEndpoint(), '/'),
                $soapClient->getWsdlUri()
            )
        );

        return $soapClient;
    }
public function generateSoapClient ( AdsSession $ session , AdsHeaderHandler $ headerHandler , AdsServiceDescriptor $ serviceDescriptor ) { $ options = [ 'trace' => true , 'encoding' => 'utf-8' , 'connection_timeout' => $ this -> soapCallTimeout , 'features' => SOAP_SINGLE_ELEMENT_ARRAYS ] ; $ soapSettings = $ session -> getSoapSettings ( ) ; $ options = $ this -> populateOptions ( $ session , $ options , $ soapSettings ) ; $ soapClient = $ this -> reflection -> createInstance ( $ serviceDescriptor -> getServiceClass ( ) , $ options ) ; $ soapClient -> setStreamContext ( $ options [ 'stream_context' ] ) ; $ soapClient -> setSoapLogMessageFormatter ( $ this -> soapLogMessageFormatter ) ; $ soapClient -> setAdsSession ( $ session ) ; $ soapClient -> setHeaderHandler ( $ headerHandler ) ; $ soapClient -> setServiceDescriptor ( $ serviceDescriptor ) ; $ soapClient -> setSoapCallTimeout ( $ this -> soapCallTimeout ) ; $ soapClient -> __setLocation ( str_replace ( sprintf ( '%s://%s' , parse_url ( $ soapClient -> getWsdlUri ( ) , PHP_URL_SCHEME ) , parse_url ( $ soapClient -> getWsdlUri ( ) , PHP_URL_HOST ) ) , rtrim ( $ session -> getEndpoint ( ) , '/' ) , $ soapClient -> getWsdlUri ( ) ) ) ; return $ soapClient ; }
Generates a SOAP client that interfaces with the specified service using
configuration data from the specified ads session.

@param AdsSession $session the session to read configuration information
from
@param AdsHeaderHandler $headerHandler the header handler that will
generate HTTP and SOAP headers
@param AdsServiceDescriptor $serviceDescriptor descriptor for the service
the SOAP client is being generated to interface with
@return \SoapClient a SOAP client
@throws \UnexpectedValueException if the SOAP client could not be generated
Generates a SOAP client that interfaces with the specified service using configuration data from the specified ads session .