'ReflectionException' while using ReportUtils in Adwords API v201605

210 views
Skip to first unread message

fol...@brainlabsdigital.com

unread,
Aug 16, 2016, 8:40:31 AM8/16/16
to AdWords API Forum
Hi,

I am trying to use the Adwords PHP API ReportUtils object. 

Here is the code:

$util = new ReportUtils();
// Download report.
$report = $util->DownloadReport($reportDefinition, null, $this->adwordsClient, $options);


The same code works perfectly on the CAMPAIGN_PERFORMANCE_REPORT and on any other report. 

However it doesn't work on the SEARCH_QUERY_PERFORMANCE_REPORT

I had it working previously, but now every time I try to run this code I get the following stack trace:

PHP Notice:  Undefined index: type in /home/foluso/Documents/webProgramming/projects/sqrt/vendor/googleads/googleads-php-lib/src/Google/Api/Ads/AdWords/Util/XmlDeserializer.php on line 136
PHP Fatal error:  Uncaught exception 'ReflectionException' with message 'Property  does not exist' in /home/foluso/Documents/webProgramming/projects/sqrt/vendor/googleads/googleads-php-lib/src/Google/Api/Ads/AdWords/Util/XmlDeserializer.php:138
Stack trace:
#0 /home/foluso/Documents/webProgramming/projects/sqrt/vendor/googleads/googleads-php-lib/src/Google/Api/Ads/AdWords/Util/XmlDeserializer.php(138): ReflectionClass->getProperty('')
#1 /home/foluso/Documents/webProgramming/projects/sqrt/vendor/googleads/googleads-php-lib/src/Google/Api/Ads/AdWords/Util/XmlDeserializer.php(92): XmlDeserializer->ConvertElementToObject(Object(DOMElement), 'ApiError')
#2 /home/foluso/Documents/webProgramming/projects/sqrt/vendor/googleads/googleads-php-lib/src/Google/Api/Ads/AdWords/Util/XmlDeserializer.php(63): XmlDeserializer->ConvertElementToObject(Object(DOMElement))
#3 /home/foluso/Documents/webProgramming/projects/sqrt/vendor/googleads/googleads-php-lib/src/Google/Api/Ads/AdWords/Util/v201605/ReportUtilsDelegate.php(194): XmlDeserializer-> in /home/foluso/Documents/webProgramming/projects/sqrt/vendor/googleads/googleads-php-lib/src/Google/Api/Ads/AdWords/Util/XmlDeserializer.php on line 138

Does anyone know what I could be doing wrong please?

Like I said before, the only thing I change that produces the error, is the name of the report. 

Assume I am passing in no predicates, and only the 'AdGroupId' field into the selector. 

Thanks

fol...@brainlabsdigital.com

unread,
Aug 16, 2016, 11:32:25 AM8/16/16
to AdWords API Forum
I've found the problem that caused this.

It was the include zero impressions flag. 

Not setting it gets rid of the bug. 

Why is that?

Shwetha Vastrad (AdWords API Team)

unread,
Aug 16, 2016, 1:06:27 PM8/16/16
to AdWords API Forum
Hi,

Search Query Performance Report doesn't support zero impressions. Setting the includeZeroImpressions header to true will result in ReportDownloadError.ZERO_IMPRESSIONS_REQUEST_NOT_SUPPORTED. This is most likely the reason for the exception you encountered. 

Regards,
Shwetha, AdWords API Team.

Foluso Ogunlana

unread,
Aug 16, 2016, 1:30:21 PM8/16/16
to adwordsapiad...@google.com, AdWords API Forum
Oh wow okay. 

That's great, thank you very much!

It's great that it gives a helpful error, maybe it could be improved if the message could bubble up enough to be in the stack trace?

I say this because I spent a lot of time hunting it down, and if I had seen a single ZERO_IMPRESSIONS_NOT_SUPPORTED, it would have been obvious to me.

I can imagine other developers running into that. 

Perhaps I just missed the error message and I should be looking somewhere else?

Thanks
Foluso



--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
 
You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwor...@googlegroups.com
To unsubscribe from this group, send email to
adwords-api...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to a topic in the Google Groups "AdWords API Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/adwords-api/QbZ5pe4sTeA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to adwords-api...@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/0941eab0-0930-4918-84d4-f87505837d7a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Shwetha Vastrad (AdWords API Team)

unread,
Aug 16, 2016, 3:45:33 PM8/16/16
to AdWords API Forum
Hi Foluso, 

Are you using the examples provided in the PHP client library? The report download example has try-catch block to handle errors or exceptions that occur while executing the requests. The ReflectionException maybe due to something specific in the client environment. I would suggest that you post this issue in the PHP library's repository as they are better equipped to address this.

Ray Chang

unread,
Apr 18, 2018, 6:35:29 AM4/18/18
to AdWords API Forum
how to set includeZeroImpressions header  ?

Dhanya Sundararaju (AdWords API Team)

unread,
Apr 18, 2018, 1:07:20 PM4/18/18
to AdWords API Forum
Hi Ray,

Please refer highlighted section of this code sample to check out how to set includeZeroImpressions. If not already aware, you may refer this section of the guide for more details. Also, since this thread is quite old, could you please create a new thread if you have any further questions?

Regards,
Dhanya, AdWords API Team
Reply all
Reply to author
Forward
0 new messages