Re: PHP Fatal error: Uncaught SoapFault exception: [soap:Client] Unmarshalling Error: cvc-elt.4.3: Type 'ns1:AdGroupAd' is not validly derived from the type definition, 'long', of element 'ns1:id

104 views
Skip to first unread message
Message has been deleted

Shwetha Vastrad (AdWords API Team)

unread,
Mar 13, 2017, 2:58:04 PM3/13/17
to AdWords API Forum
Hi Dan,

In your code, I see that when you create the ExpandedTextAd object, you are setting the AdGroupAd object as the AdId. Please change this line of code to the one below and retry the request and let me know if it works. 

$ad->setId($adGroupAd->getAd()->getId());


Regards,
Shwetha, AdWords API Team.
Message has been deleted

Shwetha Vastrad (AdWords API Team)

unread,
Mar 13, 2017, 3:31:51 PM3/13/17
to AdWords API Forum
Hi,

You'll encounter the AdError.CANNOT_USE_AD_SUBCLASS_FOR_OPERATOR error when you try to modify attributes other than the status or use a concrete AdType. To update the status of an Ad, you need to include just the Ad object in the mutate operation without setting the AdType in the Ad object. Please see the PauseAd PHP example which shows how to pause an Ad. Let me know if the error is resolved after making this change. 
Reply all
Reply to author
Forward
0 new messages