Re: "Fault occurred while processing" when adding a campaign

2013-02-04 Thread David Torres (AdWords API Team)
Hi,

I've already left you a few questions and answers in this thread 
https://groups.google.com/forum/?fromgroups=#!topic/adwords-api/grCpR_CmF9Y, 
please lets follow up on it.

Best,

- David Torres - AdWords API Team

On Friday, January 25, 2013 12:15:07 PM UTC-5, Timo Aarnio wrote:
>
> Hi
>
> I'm currently trying to add campaigns to my test account. But when running 
> the script I get this error: "Fault occurred while processing."
>
> The error seems to happen when the script tries to add using the 
> budgetservice:
> [Jan 25 2013 19:03:26.00 - ERROR] email=testemail 
> effectiveUser=123456789 service=BudgetService method=mutate operators={ADD: 
> 1} responseTime=73 requestId=0004d41fe7adf2700ae5630d1737 operations=0 
> units=0 server=adwords.google.com isFault=true faultMessage=Fault 
> occurred while processing.
>
> When looking at the soap_xml.log, it shows a 500 internal server error:
> [Jan 25 2013 19:03:26.00 - ERROR] POST 
> /api/adwords/cm/v201209/BudgetService HTTP/1.1
>
> Host: adwords.google.com
>
> Connection: Keep-Alive
>
> User-Agent: PHP-SOAP/5.3.15, gzip
>
> Accept-Encoding: gzip, deflate
>
> Content-Encoding: gzip
> Content-Type: text/xml; charset=utf-8
>
> SOAPAction: ""
>
> Content-Length: 626
>
> 
> http://schemas.xmlsoap.org/soap/envelope/"; xmlns:ns1="
> https://adwords.google.com/api/adwords/cm/v201209";>
>   
> 
>   *
>   123456789
>   987654321token
>   TestTool (AwApi/3.1.1, php/5.3.15)
> 
>   
>   
> 
>   
> ADD
> 
>   TestCampaign #5102bade7612e
>   DAILY
>   
> 5000
>   
>   STANDARD
> 
>   
> 
>   
> 
>
> HTTP/1.1 500 Internal Server Error
>
> Content-Type: text/xml; charset=UTF-8
>
> Content-Encoding: gzip
>
> Date: Fri, 25 Jan 2013 17:03:22 GMT
>
> Expires: Fri, 25 Jan 2013 17:03:22 GMT
>
> Cache-Control: private, max-age=0
>
> X-Content-Type-Options: nosniff
>
> X-Frame-Options: SAMEORIGIN
>
> X-XSS-Protection: 1; mode=block
>
> Content-Length: 311
>
> Server: GSE
>
> 
> http://schemas.xmlsoap.org/soap/envelope/";>
>   
> https://adwords.google.com/api/adwords/cm/v201209";>
>   0004d41fe7adf2700ae5630d1737
>   BudgetService
>   mutate
>   0
>   73
>   0
> 
>   
>   
> 
>   soap:Server
>   Fault occurred while processing.
> 
>   
> 
>
>
> Here is the code for the script, it's practically the same as the example, 
> only with some modifications so it actually works:
>
>  require_once 
> ('adwords_api/src/Google/Api/Ads/AdWords/Lib/AdWordsUser.php');
>
> function AddCampaign($user) {
>
>   // Get the BudgetService, which loads the required classes.
>   $budgetService = $user->GetService('BudgetService', 'v201209');
>
>   // Create the shared budget (required).
>   $budget = new Budget();
>   $budget->name = 'TestCampaign #' . uniqid();
>   $budget->period = 'DAILY';
>   $budget->amount = new Money(5000);
>   $budget->deliveryMethod = 'STANDARD';
>
>   $operations = array();
>
>   // Create operation.
>   $operation = new BudgetOperation();
>   $operation->operand = $budget;
>   $operation->operator = 'ADD';
>   $operations[] = $operation;
>
>// Make the mutate request. Error pops up here.
>   $result = $budgetService->mutate($operations);
>
>   $budget = $result->value[0];
>
>   // Get the CampaignService, which loads the required classes.
>   $campaignService = $user->GetService('CampaignService', 'v201209');
>
>   $numCampaigns = 3;
>   $operations = array();
>   for ($i = 0; $i < $numCampaigns; $i++) {
> // Create campaign.
> $campaign = new Campaign();
> $campaign->name = 'TestCampaign #' . uniqid();
>
> // Set shared budget (required).
> $campaign->budget = new Budget();
> $campaign->budget->budgetId = $budget->budgetId;
>
> // Set bidding strategy (required).
> $biddingStrategy = new ManualCPC();
> $biddingStrategy->enhancedCpcEnabled = TRUE;
> $campaign->biddingStrategy = $biddingStrategy;
>
> // Set keyword matching setting (required).
> $keywordMatchSetting = new KeywordMatchSetting();
> $keywordMatchSetting->optIn = TRUE;
> $campaign->settings[] = $keywordMatchSetting;
>
> // Set network targeting (recommended).
> $networkSetting = new NetworkSetting();
> $networkSetting->targetGoogleSearch = TRUE;
> $networkSetting->targetSearchNetwork = TRUE;
> $networkSetting->targetContentNetwork = TRUE;
> $campaign->networkSetting = $networkSetting;
>
> // Set additional settings (optional).
> $campaign->status = 'ACTIVE';
> $campaign->startDate = date('Ymd', strtotime('+1 day'));
> $campaign->endDate = date('Ymd', strtotime('+1 month'));
> $campaign->adServingOptimizationStatus = 'ROTATE';
>
> // Set frequency cap (optional).
> $frequencyCap = new FrequencyCap();
> $frequencyCap->impressions = 5;
> $frequencyCap->timeUnit = 'DAY';
> $frequencyCap->level = 'AD

"Fault occurred while processing" when adding a campaign

2013-01-27 Thread Timo Aarnio
Hi

I'm currently trying to add campaigns to my test account. But when running 
the script I get this error: "Fault occurred while processing."

The error seems to happen when the script tries to add using the 
budgetservice:
[Jan 25 2013 19:03:26.00 - ERROR] email=testemail 
effectiveUser=123456789 service=BudgetService method=mutate operators={ADD: 
1} responseTime=73 requestId=0004d41fe7adf2700ae5630d1737 operations=0 
units=0 server=adwords.google.com isFault=true faultMessage=Fault occurred 
while processing.

When looking at the soap_xml.log, it shows a 500 internal server error:
[Jan 25 2013 19:03:26.00 - ERROR] POST 
/api/adwords/cm/v201209/BudgetService HTTP/1.1

Host: adwords.google.com

Connection: Keep-Alive

User-Agent: PHP-SOAP/5.3.15, gzip

Accept-Encoding: gzip, deflate

Content-Encoding: gzip
Content-Type: text/xml; charset=utf-8

SOAPAction: ""

Content-Length: 626


http://schemas.xmlsoap.org/soap/envelope/"; 
xmlns:ns1="https://adwords.google.com/api/adwords/cm/v201209";>
  

  *
  123456789
  987654321token
  TestTool (AwApi/3.1.1, php/5.3.15)

  
  

  
ADD

  TestCampaign #5102bade7612e
  DAILY
  
5000
  
  STANDARD

  

  


HTTP/1.1 500 Internal Server Error

Content-Type: text/xml; charset=UTF-8

Content-Encoding: gzip

Date: Fri, 25 Jan 2013 17:03:22 GMT

Expires: Fri, 25 Jan 2013 17:03:22 GMT

Cache-Control: private, max-age=0

X-Content-Type-Options: nosniff

X-Frame-Options: SAMEORIGIN

X-XSS-Protection: 1; mode=block

Content-Length: 311

Server: GSE


http://schemas.xmlsoap.org/soap/envelope/";>
  
https://adwords.google.com/api/adwords/cm/v201209";>
  0004d41fe7adf2700ae5630d1737
  BudgetService
  mutate
  0
  73
  0

  
  

  soap:Server
  Fault occurred while processing.

  



Here is the code for the script, it's practically the same as the example, 
only with some modifications so it actually works:

GetService('BudgetService', 'v201209');

  // Create the shared budget (required).
  $budget = new Budget();
  $budget->name = 'TestCampaign #' . uniqid();
  $budget->period = 'DAILY';
  $budget->amount = new Money(5000);
  $budget->deliveryMethod = 'STANDARD';

  $operations = array();

  // Create operation.
  $operation = new BudgetOperation();
  $operation->operand = $budget;
  $operation->operator = 'ADD';
  $operations[] = $operation;

   // Make the mutate request. Error pops up here.
  $result = $budgetService->mutate($operations);

  $budget = $result->value[0];

  // Get the CampaignService, which loads the required classes.
  $campaignService = $user->GetService('CampaignService', 'v201209');

  $numCampaigns = 3;
  $operations = array();
  for ($i = 0; $i < $numCampaigns; $i++) {
// Create campaign.
$campaign = new Campaign();
$campaign->name = 'TestCampaign #' . uniqid();

// Set shared budget (required).
$campaign->budget = new Budget();
$campaign->budget->budgetId = $budget->budgetId;

// Set bidding strategy (required).
$biddingStrategy = new ManualCPC();
$biddingStrategy->enhancedCpcEnabled = TRUE;
$campaign->biddingStrategy = $biddingStrategy;

// Set keyword matching setting (required).
$keywordMatchSetting = new KeywordMatchSetting();
$keywordMatchSetting->optIn = TRUE;
$campaign->settings[] = $keywordMatchSetting;

// Set network targeting (recommended).
$networkSetting = new NetworkSetting();
$networkSetting->targetGoogleSearch = TRUE;
$networkSetting->targetSearchNetwork = TRUE;
$networkSetting->targetContentNetwork = TRUE;
$campaign->networkSetting = $networkSetting;

// Set additional settings (optional).
$campaign->status = 'ACTIVE';
$campaign->startDate = date('Ymd', strtotime('+1 day'));
$campaign->endDate = date('Ymd', strtotime('+1 month'));
$campaign->adServingOptimizationStatus = 'ROTATE';

// Set frequency cap (optional).
$frequencyCap = new FrequencyCap();
$frequencyCap->impressions = 5;
$frequencyCap->timeUnit = 'DAY';
$frequencyCap->level = 'ADGROUP';
$campaign->frequencyCap = $frequencyCap;

// Display network targeting settings (optional).
// It can only be enabled, shown only for demonstration purposes.
// If not set this setting is enabled by default on ADD operations.
$targetRestrictSetting = new TargetRestrictSetting();
$targetRestrictSetting->useAdGroup = TRUE;
$campaign->settings[] = $targetRestrictSetting;

// Set advanced location targeting settings (optional).
$geoTargetTypeSetting = new GeoTargetTypeSetting();
$geoTargetTypeSetting->positiveGeoTargetType = 'DONT_CARE';
$geoTargetTypeSetting->negativeGeoTargetType = 'DONT_CARE';
$campaign->settings[] = $geoTargetTypeSetting;

// Create operation.
$operation = new CampaignOperation();
$operation->operand = $campa