Problem Whit schedule_report.pl

3 views
Skip to first unread message

PerfetoAdmin

unread,
Jun 23, 2009, 12:54:42 PM6/23/09
to AdWords API Forum
hello,

I try to make a report, I try to fix changing the columns,
SelectedReportType, etc, but its not work:

the error is:

Report job failed validation due to the following error: The following
SOAP fault occurred:
faultcode: soapenv:Server.userException
faultstring: org.xml.sax.SAXException: No deserializer defined for
array type {http://www.w3.org/1999/XMLSchema}ur-type

the script its not executed completely, the mensage is in the
validateReportJob.

I only need (now) get 3 columns, this columns are (Campaign Campaingid
CampaignStatus), the 'selectedReportType' => 'Campaign' and
'aggregationTypes' => ['Daily'].



this is my code (a copy of the example in google AdWord):

use strict;
use warnings;
use English '-no_match_vars';
use SOAP::Lite;
use LWP::Simple qw();
use IO::Uncompress::Gunzip qw();

binmode(STDOUT, ':utf8');

my $email = 'XXXX...@gmail.com';
my $password = 'XXXXXXXXXX';
my $client_email = 'XXXXX...@gmail.com';
my $useragent = 'Perl Sample Code';
my $developer_token = 'XXXXXXXXX++QWE';
my $application_token = '';

my $url = sprintf('https://%s.google.com/api/adwords/v13/
ReportService',
'sandbox');
my $wsdl = $url . '?wsdl';
my $service = SOAP::Lite->service($wsdl)->autotype(0)->readable(1)-
>proxy($url);

$service->on_fault(sub {
my $response = $ARG[1];
die('The following SOAP fault occurred:', "\n",
' faultcode: ', $response->faultcode(),
"\n",
' faultstring: ', $response->faultstring(),
"\n")
});
#SOAP::Lite->import(+trace => 'debug');

# Define SOAP headers.
my @headers = (
SOAP::Header->name('email' => $email),
SOAP::Header->name('password' => $password),
SOAP::Header->name('clientEmail' => $client_email),
SOAP::Header->name('useragent' => $useragent),
SOAP::Header->name('developerToken' => $developer_token),
);

my $report_job = SOAP::Data->name('job' =>
{'selectedReportType' => 'Campaign',
'name' => 'Sample Keyword Report',
'aggregationTypes' => ['Daily'],
'selectedColumns' => [qw(Campaign Campaingid CampaignStatus
)]
});


$report_job->attr({'xsi:type' => 'DefinedReportJob',
'xmlns' => 'https://adwords.google.com/api/adwords/
v13'});

eval {
# Validate report.
$service->call('validateReportJob' => $report_job, @headers);

# Schedule report.
my $job_id = $service->call('scheduleReportJob' => $report_job,
@headers)
->result();
$job_id = SOAP::Data->name('reportJobId' => $job_id);

# Wait for report to finish.
my $status = $service->call('getReportJobStatus' => $job_id,
@headers)
->result();
while ($status ne 'Completed' and $status ne 'Failed') {
printf("Report job status is '%s'.\n", $status);
sleep(30);
$status = $service->call('getReportJobStatus' => $job_id,
@headers)
->result();
}

if ($status eq 'Failed') {
die("Report job generation failed.\n");
}

# Download report.
my $report_url = $service->call('getGzipReportDownloadUrl' =>
$job_id,
@headers)->result();
printf("Report is available at '%s'.\n", $report_url);

# Write report to local file.
my $gzip_report_data = LWP::Simple::get($report_url);
my $file = 'keyword_report.xml';
IO::Uncompress::Gunzip::gunzip(\$gzip_report_data => $file);
printf("Report has been written to '%s'.\n", $file);
};


if ($@) {
print("Report job failed validation due to the following error: ",
$@, "\n");
}




thanks for your help.

Regards,
Benjamin

AdWords API Advisor

unread,
Jun 25, 2009, 12:17:26 PM6/25/09
to AdWords API Forum
Hello Benjamin,

It would sound like the XML you're sending to the AdWords API isn't
being properly serialized. I don't know exactly why that would be, but
I'd recommend double-checking to make sure you're using the latest
release of SOAP::Lite and the XML modules that it depends on.

If it's not a module version issue, could you try turning on logging
of your outgoing SOAP requests by uncommenting this line:

#SOAP::Lite->import(+trace => 'debug');

Take a look at what you're sending--do you notice anything odd,
specifically related to a http://www.w3.org/1999/XMLSchema namespace
attribute?

I haven't run into similar issues when running the same sample code
in the past.

Cheers,
-Jeff Posnick, AdWords API Team


On Jun 23, 12:54 pm, PerfetoAdmin <perfeto...@gmail.com> wrote:
> hello,
>
> I try to make a report, I try to fix changing the columns,
> SelectedReportType, etc, but its not work:
>
> the error is:
>
> Report job failed validation due to the following error: The following
> SOAP fault occurred:
>   faultcode: soapenv:Server.userException
>   faultstring: org.xml.sax.SAXException: No deserializer defined for
> array type {http://www.w3.org/1999/XMLSchema}ur-type
>
> the script its not executed completely, the mensage is in the
> validateReportJob.
>
> I only need (now) get 3 columns, this columns are (Campaign Campaingid
> CampaignStatus), the 'selectedReportType' => 'Campaign'  and
> 'aggregationTypes' => ['Daily'].
>
> this is my code (a copy of the example in google AdWord):
>
> use strict;
> use warnings;
> use English '-no_match_vars';
> use SOAP::Lite;
> use LWP::Simple qw();
> use IO::Uncompress::Gunzip qw();
>
> binmode(STDOUT, ':utf8');
>
> my $email = 'XXXXXX...@gmail.com';
> my $password = 'XXXXXXXXXX';
> my $client_email = 'XXXXXXXX...@gmail.com';
Reply all
Reply to author
Forward
0 new messages