Report job failed validation due to the following error: "null".

46 views
Skip to first unread message

raj

unread,
Jan 20, 2009, 12:02:51 PM1/20/09
to AdWords API Forum
Hi,
I am trying to run report to get clicks , impressions. I tried to
do with ReportService that I saw in the sample code. But I when ran
the report I am getting this error "Report job failed validation
due to the following error: "null". "
Could you please tell me why am I getting this error?
Here is my code:-
private static final String namespace =
"https://adwords.google.com/api/adwords/v12";

public static void main(String[] args) {
try {
// Set up service connection.
ReportInterface service =
new ReportServiceLocator().getReportService();

// Define SOAP headers.
((Stub) service).setHeader(namespace, "email", email);
((Stub) service).setHeader(namespace, "password", password);
((Stub) service).setHeader(namespace, "clientEmail",
clientEmail);
((Stub) service).setHeader(namespace, "useragent", useragent);
((Stub) service).setHeader(namespace, "developerToken",
developerToken);
((Stub) service).setHeader(
namespace, "applicationToken", applicationToken);

// Create report job structure.
DefinedReportJob job = new DefinedReportJob();
job.setSelectedReportType("Keyword");
job.setName("Sample Keyword Report");
job.setAggregationTypes(new String[] {"Summary"});
job.setAdWordsType(AdWordsType.SearchOnly);
job.setKeywordType(KeywordType.Broad);
GregorianCalendar startDay = new GregorianCalendar(2008,
Calendar.OCTOBER,1);
GregorianCalendar endDay = new GregorianCalendar(2008,
Calendar.DECEMBER,31);
job.setStartDay(startDay);
job.setEndDay(endDay);
job.setSelectedColumns(new String[] {
"Campaign", "AdGroup", "Keyword", "KeywordStatus",
"KeywordMinCPC",
"KeywordDestUrlDisplay", "Impressions", "Clicks", "CTR",
"AveragePosition"});

// Validate report.
try {
service.validateReportJob(job);

// Schedule report.
long jobId = service.scheduleReportJob(job);

// Wait for report to finish.
ReportJobStatus status = service.getReportJobStatus(jobId);
while(status != ReportJobStatus.Completed &&
status != ReportJobStatus.Failed) {
System.out.println(
"Report job status is \"" + status.getValue() + "\".");
try {
Thread.sleep(30000);
} catch(InterruptedException e) {}
status = service.getReportJobStatus(jobId);
}

if(status == ReportJobStatus.Failed) {
System.out.println("Report job generation failed.");
System.exit(0);
}

// Download report.
String url = service.getGzipReportDownloadUrl(jobId);
System.out.println("Report is available at \"" + url +
"\".");
} catch (ApiException e) {
System.out.println(
"Report job failed validation due to the following error:
\""
+ e.getMessage() + "\".");
}
} catch(Exception e) {
e.printStackTrace();
}
}
}

AdWords API Advisor

unread,
Jan 20, 2009, 4:56:50 PM1/20/09
to AdWords API Forum
Hello,

If you're just getting started with the AdWords API in C#, I'd
recommend that you use the official .NET client library instead of
trying to piece together the standalone pieces of sample code:

http://code.google.com/p/google-api-adwords-dotnet/

The client library will make it much easier to do things like
schedule reports, and it includes samples written against the client
library illustrating how to do that.

Cheers,
-Jeff Posnick, AdWords API Team

raj

unread,
Jan 20, 2009, 5:47:48 PM1/20/09
to AdWords API Forum
My development environment is java and axis. I have all the wsdls and
all the java classes. As per our last meeting in my company, it's
fixed that we need to develope all the code in java. Becuase we are
currently working in java side not in dot net side. My target is to
get .xml file for clicks, impressions, average position etc for
campaigns. That can be done either this way that I have found in other
ad words link http://www.mail-archive.com/adwor...@googlegroups.com/msg01351.html
. As we know getCampaignStats method contains clicks, impressions etc.
As you can see in my code below.
private static final String namespace = "https://adwords.google.com/
api/adwords/v12";
private static int[] campaignIds;
static Calendar endDay;
static Calendar startDay ;


public static void main(String[] args) throws Exception {
try {
// Set up service connection.
CampaignInterface service = new CampaignServiceLocator
().getCampaignService();

// Define SOAP headers.
((Stub) service).setHeader(namespace, "email", email);
((Stub) service).setHeader(namespace, "password", password);
((Stub) service).setHeader(namespace, "clientEmail", clientEmail);
((Stub) service).setHeader(namespace, "useragent", useragent);
((Stub) service).setHeader(namespace, "developerToken",
developerToken);
((Stub) service).setHeader(namespace, "applicationToken",
applicationToken);
StatsRecord[] campaigns = null;
// Get all campaigns.
campaigns = service.getCampaignStats(campaignIds,startDay,endDay);
for(int i = 0; i < 10; i++)
{
System.out.println("The value is " +campaigns[i].getClicks());
System.out.println("The value is " +campaigns[i].getImpressions());
System.out.println("The value is " +campaigns[i].getAveragePosition
());
System.out.println("The value is " +campaigns[i].getConversions());
System.out.println("The value is " +campaigns[i].getCost());
System.out.println("The value is " +campaigns[i].getConversionRate
());
}
} catch (ApiException e) {
e.printStackTrace();
} catch (RemoteException e) {
e.printStackTrace();
}
finally
{
}
}
}

OR

The other way is ------> You can either schedule a report using
the ReportService for a particular date and include the relevant
columns( clicks, impressions,average position).


AS per our requirement we need all these data in xml format. That is
only possible through ReportService.
When I ran the code that I send to you in my previous mail, I am
getting this error =======================> Report job failed
validation due to the following error: "null".
Could you please help me to figure out why am I getting this error?
Thanks in advance
Raj






On Jan 20, 1:56 pm, AdWords API Advisor <adwordsapiadvi...@google.com>
wrote:

AdWords API Advisor

unread,
Jan 20, 2009, 5:56:55 PM1/20/09
to AdWords API Forum
My mistake--I always confuse Java and C# unless I pay close attention
to the System.out vs. Console stuff. In any case, there's the Java
client library that would be a better choice:

http://code.google.com/p/google-api-adwords-java/

There's an example included with the Java client library for
scheduling and downloading a report, which will be in XML format.
You'll have to change some of the report options to match exactly what
you're looking for, using this information as your guide:

http://code.google.com/intl/en/apis/adwords/docs/developer/DefinedReportJob.html

Cheers,
-Jeff Posnick, AdWords API Team


On Jan 20, 5:47 pm, raj <adp-...@adp.com> wrote:
> My development environment is  java and axis. I have all the wsdls and
> all the java classes. As per our last meeting in my company, it's
> fixed that we need to develope all the code in java. Becuase we are
> currently working in java side not in dot net side. My target is to
> get .xml file for clicks, impressions, average position etc for
> campaigns. That can be done either this way that I have found in other
> ad words linkhttp://www.mail-archive.com/adwor...@googlegroups.com/msg01351.html

raj

unread,
Jan 20, 2009, 6:37:03 PM1/20/09
to AdWords API Forum
Jeff,
I have already defined this job with required parameters for soap
headers.Please see my code below mentioned here. It prints "Jeff" that
I did for testing purpose. But it fails after that. It did not print
hello. I took this code from sample code that are available at Ad
words website in the sample code section for reportService. I just
changed startday and endDay as parameters only. That's the only change
I did and added my required parameter for soap header.

private static final String namespace = "https://adwords.google.com/
api/adwords/v12";

public static void main(String[] args) {
try {
// Set up service connection.
ReportInterface service = new ReportServiceLocator
().getReportService();

// Define SOAP headers.
((Stub) service).setHeader(namespace, "email", email);
((Stub) service).setHeader(namespace, "password", password);
((Stub) service).setHeader(namespace, "clientEmail",
clientEmail);
((Stub) service).setHeader(namespace, "useragent", useragent);
((Stub) service).setHeader(namespace, "developerToken",
developerToken);
((Stub) service).setHeader(namespace, "applicationToken",
applicationToken);

// Create report job structure.
DefinedReportJob job = new DefinedReportJob();
job.setSelectedReportType("Keyword");
job.setName("Sample Keyword Report");
job.setAggregationTypes(new String[] {"Summary"});
job.setAdWordsType(AdWordsType.SearchOnly);
job.setKeywordType(KeywordType.Broad);

Calendar startDay = Calendar.getInstance(); //here set as
today that I saw on adwords web site
GregorianCalendar endDay = new GregorianCalendar(2037,
Calendar.DECEMBER,30); //here to set end date

job.setStartDay(startDay);
job.setEndDay(endDay);
job.setSelectedColumns(new String[] {
"Campaign", "AdGroup", "Keyword", "KeywordStatus",
"KeywordMinCPC",
"KeywordDestUrlDisplay", "Impressions", "Clicks", "CTR",
"AveragePosition"});

// Validate report.
try {
System.out.println("Jeff"); // till now
it is fine
service.validateReportJob(job); //fails here
System.out.println("hello");
Could you please help why it's not validating report ?===============>
service.validateReportJob(job); //fails here
I did not make any change.I just called this API. I checked in the
code also.It should take job as input parameter that I did here.
Thanks
Rajni

On Jan 20, 2:56 pm, AdWords API Advisor <adwordsapiadvi...@google.com>
wrote:
> My mistake--I always confuse Java and C# unless I pay close attention
> to the System.out vs. Console stuff. In any case, there's the Java
> client library that would be a better choice:
>
>  http://code.google.com/p/google-api-adwords-java/
>
> There's an example included with the Java client library for
> scheduling and downloading a report, which will be in XML format.
> You'll have to change some of the report options to match exactly what
> you're looking for, using this information as your guide:
>
>  http://code.google.com/intl/en/apis/adwords/docs/developer/DefinedRep...

Tino Hertlein

unread,
Jan 21, 2009, 3:39:45 AM1/21/09
to AdWords API Forum
Hi Rajni,

there are some additional properties in the APIException that is thrown:

int code;
com.google.api.adwords.v13.ApiError[] errors;
boolean internal;
java.lang.String message1;
java.lang.String trigger;

If you print the content of these properties in your catch-block, the error might become obvious.


Tino

--
Refined Labs GmbH
Landwehrstraße 17
80336 München
Tel +49 89 1392879-0
ti...@refinedlabs.com
http://www.refinedlabs.com

Sitz: München
AG München HRB 166589
Geschäftsführer:
Thomas Bindl, Stephan Seitz


-----Ursprüngliche Nachricht-----
Von: adwor...@googlegroups.com [mailto:adwor...@googlegroups.com] Im Auftrag von raj
Gesendet: Mittwoch, 21. Januar 2009 00:37
An: AdWords API Forum
Betreff: AdWords API Re: Report job failed validation due to the following error: "null".

AdWords API Advisor

unread,
Jan 21, 2009, 10:54:01 AM1/21/09
to AdWords API Forum
Additionally, and more importantly, if you're doing new development as
part of something more than a one-off project, I would recommend that
you use the Java client library instead of just following along with
the sample code, which assumes you're generating your own SOAP
bindings using Axis.

To quote from the Code Samples page, http://code.google.com/intl/en/apis/adwords/docs/samples.html

"These code samples demonstrate simple interactions with AdWords using
various SOAP toolkits. They are designed to help you better understand
the basics of AdWords API.

For code intended to help you develop complex applications, download
one of the AdWords API client libraries."

I'm not saying that the sample code shouldn't work, and if you have a
strong reason for not wanting to go that route instead of the client
library then we should be able to figure out what's wrong (providing a
SOAP trace or getting the additional details from the SOAP fault as
Tino suggests should be the first step). Using the official client
library will allow you to develop against all of the services in the
AdWords API in a unified manner, using a shared common object to
represent your credentials, and allow you to take advantage of the
built-in logging and unit accounting methods it offers.

Cheers,
-Jeff Posnick, AdWords API Team

On Jan 21, 3:39 am, "Tino Hertlein" <t...@refinedlabs.com> wrote:
> Hi Rajni,
>
> there are some additional properties in the APIException that is thrown:
>
> int code;
> com.google.api.adwords.v13.ApiError[] errors;
> boolean internal;
> java.lang.String message1;
> java.lang.String trigger;
>
> If you print the content of these properties in your catch-block, the error might become obvious.
>
> Tino
>
> --
> Refined Labs GmbH
> Landwehrstraße 17
> 80336 München
> Tel +49 89 1392879-0
> t...@refinedlabs.comhttp://www.refinedlabs.com
> ...
>
> read more »

raj

unread,
Jan 21, 2009, 11:39:16 AM1/21/09
to AdWords API Forum
Jeff,
Yes, you are right. I generated my own SOAP bindings using Axis.In
my requirement I want to get clicks, impressions etc for all my
clients in the .xml report format. That I found is possible through
the report service . As per my knowledge it is going to return a link
from where I can download .xml format report for clicks, impressions
for all my clients that I have already specified as one of array
job.setSelectedColumns(new String[] {
"Campaign", "AdGroup", "Keyword", "KeywordStatus",
"KeywordMinCPC",
"KeywordDestUrlDisplay", "Impressions", "Clicks", "CTR",
"AveragePosition"});
I am using ad words v12 and I already added
import com.google.api.adwords.v12.ApiException;

for catching error I have this block
catch (ApiException e) {
System.out.println(
"Report job failed validation due to the following error:
\""
+ e.getMessage() + "\".");
}

Then it should throw that error message.
Thanks
Raj

On Jan 21, 7:54 am, AdWords API Advisor <adwordsapiadvi...@google.com>
wrote:
> Additionally, and more importantly, if you're doing new development as
> part of something more than a one-off project, I would recommend that
> you use the Java client library instead of just following along with
> the sample code, which assumes you're generating your own SOAP
> bindings using Axis.
>
> To quote from the Code Samples page,http://code.google.com/intl/en/apis/adwords/docs/samples.html
> ...
>
> read more »

raj

unread,
Jan 21, 2009, 12:27:43 PM1/21/09
to AdWords API Forum
Jeff,
Finally I found that I am getting this error.

Report job failed validation due to the following
error: "This account has reached its
user specified budget.".

Now Could you please help me why am I getting this error? What is
cause of this problem ? How it can be resolved ?
Thanks in advance.
Raj
Report job failed validation due to the following error: "This account
has reached its user specified budget.".

On Jan 21, 7:54 am, AdWords API Advisor <adwordsapiadvi...@google.com>
wrote:
> Additionally, and more importantly, if you're doing new development as
> part of something more than a one-off project, I would recommend that
> you use the Java client library instead of just following along with
> the sample code, which assumes you're generating your own SOAP
> bindings using Axis.
>
> To quote from the Code Samples page,http://code.google.com/intl/en/apis/adwords/docs/samples.html
> ...
>
> read more »

AdWords API Advisor

unread,
Jan 22, 2009, 11:55:55 AM1/22/09
to AdWords API Forum
Hello Raj,

That error indicates that you've reached your user-defined monthly
spending limit on AdWords API units. I'd recommend that you log into
the AdWords web interface at https://adwords.google.com/ using the
credentials of the MCC account that has your API tokens. Once logged
in, go to the "My Account" tab and then the "AdWords API Center" sub-
tab. There you should see a summary of how many AdWords API units
you've already consumed for the current month, as well as a section
marked "Rate and Budget". You can modify your monthly budget there to
increase the maximum amount of money you're willing to spend per month
on AdWords API charges. If you're not willing to spend any more money
this month then you won't be able to make successful AdWords API calls
and you'll continue to receive that error message until the next month
begins.

Cheers,
-Jeff Posnick, AdWords API Team


> ...
>
> read more »
Reply all
Reply to author
Forward
0 new messages