Using this package for laravel: https://github.com/nikolajlovenhardt/laravel-google-ads
When i try to write a campaign, the following error occur:
SoapFault in AdsSoapClient.php line 115: Unmarshalling Error: cvc-elt.4.3: Type 'ns1:Budget' is not validly derived from the type definition, 'Campaign', of element 'ns1:operand'.
soap.log: http://pastebin.com/raw/TmU6XSfp
[2017-03-10 14:33:57] AW_SOAP.INFO: clientCustomerId=556-905-2150 operations=1 service=BudgetService method=mutate responseTime=145 requestId=00054a61407809890a378107c00d151f server=adwords.google.com isFault=0 faultMessage= [2017-03-10 14:33:58] AW_SOAP.WARNING: clientCustomerId=556-905-2150 operations= service=CampaignService method=mutate responseTime= requestId= server=adwords.google.com isFault=1 faultMessage=Unmarshalling Error: cvc-elt.4.3: Type 'ns1:Budget' is not validly derived from the type definition, 'Campaign', of element 'ns1:operand'. [2017-03-10 14:33:58] AW_SOAP.NOTICE: POST /api/adwords/cm/v201609/CampaignService?wsdl HTTP/1.1 Host: adwords.google.com Connection: Keep-Alive User-Agent: PHP-SOAP/7.1.2-3+deb.sury.org~xenial+1 Content-Type: text/xml; charset=utf-8 SOAPAction: "" Content-Length: 1436 Authorization: REDACTED
556-905-2150REDACTEDunknown (AwApi-PHP, googleads-php-lib/25.2.0, PHP/7.1.2-3+deb.sury.org~xenial+1)falsefalseADDInterplanetary Cruise Budget
58c2b955417e250000000STANDARDADDInterplanetary Cruise
58c2b955cc997PAUSED1050511653DISPLAYMANUAL_CPC
HTTP/1.1 500 Internal Server Error Content-Type: text/xml; charset=UTF-8 Date: Fri, 10 Mar 2017 14:33:58 GMT Expires: Fri, 10 Mar 2017 14:33:58 GMT Cache-Control: private, max-age=0 X-Content-Type-Options: nosniff X-Frame-Options: SAMEORIGIN X-XSS-Protection: 1; mode=block Server: GSE Alt-Svc: quic=":443"; ma=2592000; v="36,35,34" Accept-Ranges: none Vary: Accept-Encoding Transfer-Encoding: chunked
soap:ClientUnmarshalling Error: cvc-elt.4.3: Type 'ns1:Budget' is not validly derived from the type definition, 'Campaign', of element 'ns1:operand'.
Copied from the "Basic Operations Samples"
$customerClientId = 'xxx-xxx-xxxx';
$adWordsService = new AdWordsService();
/** @var BudgetService $budgetService */
$budgetService = $adWordsService->getService(BudgetService::class, $customerClientId);
// Create the shared budget (required).
$budget = new Budget();
$budget->setName('Interplanetary Cruise Budget #' . uniqid());
$money = new Money();
$money->setMicroAmount(50000000);
$budget->setAmount($money);
$budget->setDeliveryMethod(BudgetBudgetDeliveryMethod::STANDARD);
$operations = [];
// Create a budget operation.
$operation = new BudgetOperation();
$operation->setOperand($budget);
$operation->setOperator(Operator::ADD);
$operations[] = $operation;
// Create the budget on the server.
$result = $budgetService->mutate($operations);
$budget = $result->getValue()[0];
// Create a campaign with only required settings.
$campaign = new Campaign();
$campaign->setName('Interplanetary Cruise #' . uniqid());
$campaign->setAdvertisingChannelType(AdvertisingChannelType::DISPLAY);
// Set shared budget (required).
$campaign->setBudget(new Budget());
$campaign->getBudget()->setBudgetId($budget->getBudgetId());
// Set bidding strategy (required).
$biddingStrategyConfiguration = new BiddingStrategyConfiguration();
$biddingStrategyConfiguration->setBiddingStrategyType(
BiddingStrategyType::MANUAL_CPC);
$campaign->setBiddingStrategyConfiguration($biddingStrategyConfiguration);
$campaign->setStatus(CampaignStatus::PAUSED);
// Create a campaign operation and add it to the operations list.
$operation = new CampaignOperation();
$operation->setOperand($campaign);
$operation->setOperator(Operator::ADD);
$operations[] = $operation;
/** @var CampaignService $campaignService */
$campaignService = $adWordsService->getService(CampaignService::class, $customerClientId);
$result = $campaignService->mutate($operations);
foreach ($result->getValue() as $campaign) {
printf("Campaign with name '%s' and ID %d was added.
",
$campaign->getName(),
$campaign->getId()
);
}
Receiving campaigns with the sample code works...