/**
  * The constructor for the AdWords API SOAP client factory.
  * @param AdsUser $user the user which the client will use for credentials
  * @param string $version the version to generate clients for
  * @param string $server the server to generate clients for
  * @param bool $validateOnly if the clients should be created in validateOnly
  *     mode
  * @param bool $partialFailure if the service should be created in
  *     partialFailure mode
  */
 public function __construct(AdsUser $user, $version, $server, $validateOnly, $partialFailure)
 {
     if ($version >= 'v201109' && $user->GetHeaderValue('clientEmail') != null) {
         throw new \Exception('The header "clientEmail" is not compatible with ' . 'versions v201109 and later. Use clientCustomerId instead.');
     }
     $headerOverrides = array();
     if (isset($validateOnly) || isset($partialFailure)) {
         $headerOverrides['validateOnly'] = $validateOnly;
         $headerOverrides['partialFailure'] = $partialFailure;
     }
     parent::__construct($user, $version, $server, 'adwords', $headerOverrides);
 }
コード例 #2
0
 /**
  * Gets the service by its service name.
  *
  * @param string            $serviceName the service name
  * @param SoapClientFactory $serviceFactory the service factory
  *
  * @return \SoapClient the instantiated service
  */
 public function GetServiceSoapClient($serviceName, SoapClientFactory $serviceFactory)
 {
     return $serviceFactory->GenerateSoapClient($serviceName);
 }