Skip Menu |

This queue is for tickets about the Microsoft-AdCenter CPAN distribution.

Report information
The Basics
Id: 68441
Status: resolved
Priority: 0/
Queue: Microsoft-AdCenter

People
Owner: Nobody in particular
Requestors: tobes [...] tobestool.net
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Unable to create reports
Date: Tue, 24 May 2011 16:56:40 +0100
To: bug-Microsoft-AdCenter [...] rt.cpan.org
From: Toby Wilkinson <tobes [...] tobestool.net>
Hi, I'm trying to use your library to retrieve performance data from MSN adcenter. In order to get the traffic on the relevant adverts, I'm trying to schedule some performance reports. Unfortunately I'm unable to do this successfully. I'm unsure if this is a fault in the library or simply my using it incorrectly. Any pointers to get me going in the right direction gratefully accepted. The code I have is as follows: # Create the service client my %logonParams = (ApplicationToken => $login->{'api_dev_token'}, CustomerAccountId => $login->{'account_id'}, CustomerId => $login->{'customer_id'}, DeveloperToken => $login->{'api_dev_token'}, Password => $login->{'api_password'}, UserName => $login->{'api_user'}, RetrySettings => [$retry]); if ($login->{'sandbox'}) { $logonParams{'EndPoint'} = 'https://sandboxapi.adcenter.microsoft.com/Api/Advertiser/v7/Reporting/ReportingService.svc?wsdl'; } # Create the service client my $reporting_service = Microsoft::AdCenter::V7::ReportingService->new(%logonParams); my $reportRequest = Microsoft::AdCenter::V7::ReportingService::AdGroupPerformanceReportRequest->new (ReportName => 'Example AdGroupReport', Aggregation=> 'Daily', Scope=> {AccountIds => 'NULL'}, Time => 'LastFourWeeks', Columns => ['AdGroupId', 'Clicks', 'Spend']); my $response = $reporting_service->SubmitGenerateReport (ReportRequest => $reportRequest); print Dumper($response); Running this results in the following response (I'm using the sandbox at present for development): $VAR1 = bless( { 'faultcode' => 'a:DeserializationFailed', 'faultstring' => 'The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter https://adcenter.microsoft.com/v7:ReportRequest. The InnerException message was \'Error in line 1 position 1948. Expecting state \'Element\'.. Encountered \'Text\' with name \'\', namespace \'\'. \'. Please see InnerException for more details.' }, 'Microsoft::AdCenter::SOAPFault' ); Thanks for any help! --Toby
Hi Toby Sorry for my late response. While quickly scanning through your code, I found one problem in it. When you create the AdGroupPerformanceReportRequest object, the 'Scope' field should be assigned with an AccountReportScope object instead of a hash ref. Would you please try fixing that and try again? There might be other problems that I am not aware of; so please feel free to reopen or create a new ticket if the problem persists. -Xerxes On Tue May 24 12:01:14 2011, tobes@tobestool.net wrote: Show quoted text
> Hi, > > I'm trying to use your library to retrieve performance data from MSN > adcenter. In order to get the traffic on the relevant adverts, I'm > trying to schedule some performance reports. Unfortunately I'm unable > to > do this successfully. > > I'm unsure if this is a fault in the library or simply my using it > incorrectly. Any pointers to get me going in the right direction > gratefully accepted. The code I have is as follows: > > # Create the service client > my %logonParams = (ApplicationToken => $login->{'api_dev_token'}, > CustomerAccountId => $login->{'account_id'}, > CustomerId => $login->{'customer_id'}, > DeveloperToken => $login->{'api_dev_token'}, > Password => $login->{'api_password'}, > UserName => $login->{'api_user'}, > RetrySettings => [$retry]); > > if ($login->{'sandbox'}) { > $logonParams{'EndPoint'} = >
'https://sandboxapi.adcenter.microsoft.com/Api/Advertiser/v7/Reporting/ReportingService.svc?wsdl'; Show quoted text
> } > > # Create the service client > my $reporting_service = > Microsoft::AdCenter::V7::ReportingService->new(%logonParams); > > my $reportRequest = >
Microsoft::AdCenter::V7::ReportingService::AdGroupPerformanceReportRequest- Show quoted text
> >new
> (ReportName => 'Example AdGroupReport', > Aggregation=> 'Daily', > Scope=> {AccountIds => 'NULL'}, > Time => 'LastFourWeeks', > Columns => ['AdGroupId', 'Clicks', 'Spend']); > > my $response = $reporting_service->SubmitGenerateReport > (ReportRequest => $reportRequest); > > print Dumper($response); > > Running this results in the following response (I'm using the sandbox > at > present for development): > > $VAR1 = bless( { > 'faultcode' => 'a:DeserializationFailed', > 'faultstring' => 'The formatter threw an exception while trying to > deserialize the message: There was an error while trying to > deserialize > parameter https://adcenter.microsoft.com/v7:ReportRequest. The > InnerException message was \'Error in line 1 position 1948. Expecting > state \'Element\'.. Encountered \'Text\' with name \'\', namespace > \'\'. \'. Please see InnerException for more details.' > }, 'Microsoft::AdCenter::SOAPFault' ); > > Thanks for any help! > > --Toby
Subject: Re: [rt.cpan.org #68441] Unable to create reports
Date: Tue, 31 May 2011 15:29:51 +0100
To: bug-Microsoft-AdCenter [...] rt.cpan.org
From: Toby Wilkinson <tobes [...] tobestool.net>
Hello Xerxes! Thanks for your reply, I feared that I might be making a simple mistake like that. Show quoted text
> While quickly scanning through your code, I > found one problem in it. When you create the > AdGroupPerformanceReportRequest object, the 'Scope' field should be > assigned with an AccountReportScope object instead of a hash ref. Would > you please try fixing that and try again?
I've tried several variations on this, and I've not managed to make it work yet. The code is currently as follows: my $scope = Microsoft::AdCenter::V7::ReportingService::AccountReportScope->new( AccountIds => 124822); my $reportRequest = Microsoft::AdCenter::V7::ReportingService::AdGroupPerformanceReportRequest->new( ReportName => '3SB-AdGroupReport', Aggregation=> 'Daily', Scope => $scope, Time => 'LastFourWeeks', Columns => ['AdGroupId', 'Clicks', 'Spend']); (That accountId is the id of my Sandbox account.) That however results in a error as follows: Type mismatch at /usr/local/share/perl/5.12.3/Microsoft/AdCenter/Service.pm line 271. I've tried passing in a reference and various combinations of blank lists of accountIds (as the MS documentation says that if this is NULL, all available accounts will be included in the report, which would be ideal) however everything I've tried has boiled down to the Type Mismatch error seen above or the DeserializationFailed response from the API in my original error :(. Another nudge in the right direction would be much appreciated! Thanks in advance. --Toby
Hi Toby According to MSDN, the data type for AccountReportScope.AccountIds is 'int array'. So in your code, you should create the object like this: Show quoted text
> my $scope = > Microsoft::AdCenter::V7::ReportingService::AccountReportScope->new( > AccountIds => [ 124822 ]);
(the account id is now surrounded by []) Again, there might be other issues that I am not aware of. So please feel free to reopen if this still doesn't work. -Xerxes On Tue May 31 10:34:05 2011, tobes@tobestool.net wrote: Show quoted text
> Hello Xerxes! > > Thanks for your reply, I feared that I might be making a simple > mistake > like that. >
> > While quickly scanning through your code, I > > found one problem in it. When you create the > > AdGroupPerformanceReportRequest object, the 'Scope' field should be > > assigned with an AccountReportScope object instead of a hash ref.
> Would
> > you please try fixing that and try again?
> > I've tried several variations on this, and I've not managed to make it > work yet. The code is currently as follows: > > my $scope = > Microsoft::AdCenter::V7::ReportingService::AccountReportScope->new( > AccountIds => 124822); > > my $reportRequest = > Microsoft::AdCenter::V7::ReportingService::AdGroupPerformanceReportRequest-
> >new(
> ReportName => '3SB-AdGroupReport', > Aggregation=> 'Daily', > Scope => $scope, > Time => 'LastFourWeeks', > Columns => ['AdGroupId', 'Clicks', 'Spend']); > > (That accountId is the id of my Sandbox account.) > > That however results in a error as follows: > > Type mismatch at > /usr/local/share/perl/5.12.3/Microsoft/AdCenter/Service.pm line 271. > > I've tried passing in a reference and various combinations of blank > lists of accountIds (as the MS documentation says that if this is > NULL, > all available accounts will be included in the report, which would be > ideal) however everything I've tried has boiled down to the Type > Mismatch error seen above or the DeserializationFailed response from > the > API in my original error :(. > > Another nudge in the right direction would be much appreciated! > > Thanks in advance. > > --Toby >