Subject: | ReportRequest type not set in SubmitGenerateReport |
Problem: Report request error due to invalid report type.
Cause: The report type is hard coded to "ReportRequest" instead of being
determined from the object passed to the SubmitGenerateReport method.
I'm trying to submit a KeywordPerformanceReportRequest as follows:
my $report_request =
Microsoft::AdCenter::ReportingService::KeywordPerformanceReportRequest
->new
->Aggregation('Daily')
->Columns(@columns)
->Scope($scope)
->Time($report_time);
my $report_response = $report_service->SubmitGenerateReport(
ReportRequest => $report_request);
But because of this source code in ReportingService.pm:
188 parameters => [
189 { name => 'ReportRequest', type => 'ReportRequest',
namespace => 'https://adcenter.microsoft.com/v6' }
190 ]
The XML tag in the SOAP request will always look like this:
<v6:ReportRequest xsi:type="v6:ReportRequest">
When it needs to look like this:
<v6:ReportRequest xsi:type="v6:KeywordPerformanceReportRequest">
As a temporary work-around, I've added the following code to my local
ReportingService.pm:
my $report_type = ( exists $args{'ReportRequest'} &&
$args{'ReportRequest'}->can('_type_name') ) ?
$args{'ReportRequest'}->_type_name :
'ReportRequest';
And then use $report_type as the value for type in line 189.