AnsweredAssumed Answered

Has anyone been successful at getting getURLForCPCode working in Windows?

Question asked by Gary Hughes-Fenchel on Aug 24, 2015
Latest reply on Aug 24, 2015 by Gary Hughes-Fenchel

I'm trying to get getURLForCPCode working in Windows 8. I started in Python using SUDS. Worked great ... until the results were too large to handle without an attachment. I couldn't find any support for attachments in SOAP in Python in any library. I did manage to find a site that claimed that SUDS did not, in fact, support attachments. If you know of a library that supports attachments please let me know. I don't know much about soap.

I switched then to Perl. The Akamai supported examples are in PERL. I don't know Perl very well (that is an understatement), but I was able to get a response with an attachment ... but got a response of 'Can't call method "stringify_body" on an undefined value' . If I tried to print the response, however, I was told the response was too big.

I'm told the supplied examples work fine in Linux/Unix.

 

Here is the relevant piece of the code in PERL.

And, before you asked, I started with att.pl; then I switched to HttpDownloads.pl

 

 

 

#example for url report, find any url contains "doubleclick"

    #url report without strict search criteria is large. If you know it will be large, please

    #be prepared to handle attachment. See att.pl for example.

    @columns=($COLUMN_URL, $COLUMN_OK_VOLUME, $COLUMN_ERROR_VOLUME, $COLUMN_4xx);

#    my $filter;

    my $filter=SOAP::Data->new(name => 'in5', type => 'ns:UrlReportFilter', attr => {'xmlns:akaaimsdt' => 'https://control.akamai.com/Data.xsd'} );

    my $op1=SOAP::Data->new(name=>'operator', type => 'akaaimsdt:UrlReportFilterOperatorEnum', value => 'contains' );

    my $flag=SOAP::Data->new(name=>'caseSensitive', type => 'xsd:boolean', value => 'false' );

    # gghf $filter->value({ 'operator' => $op1, 'operand' => 'chicago', 'caseSensitive' => $flag });

    $filter->type('akaaimsdt:UrlReportFilter');

    # gghf original  my $returnResult = $service->getURLForCPCode(@cpCodes, "20060416", "20060416", \@columns, $COLUMN_OK_VOLUME, $filter);

    my @fruitcake=[162537];

    # gghf my $returnResult = $service->getURLForCPCode(@fruitcake, "20150801", "20150801", \@columns, $COLUMN_OK_VOLUME, $filter);

    # gghf this works!!my $returnResult = $service->getURLForCPCode(@fruitcake, "20150801", "20150801", \@columns, $COLUMN_OK_VOLUME, );

    #my $returnResult = $service->getURLDailyAggregationForCPCode(@cpCodes, "20060416", "20060416", $COLUMN_OK_VOLUME, $filter);

 

    #print report here.

    # print $returnResult;

 

    # $filter->value({ 'operator' => $op1, 'operand' => 'chicago', 'caseSensitive' => $flag });

    $filter->value({ 'operator' => $op1, 'operand' => 'e', 'caseSensitive' => 'false' });

 

     my $response = $service->getURLForCPCode(SOAP::Data->new(name => 'in0', type => 'ns:ArrayOfInt', attr => {'xmlns:ns' => 'https://control.akamai.com/HttpDownloadsReportService.xsd'}, value => @fruitcake ),

SOAP::Data->new(name => 'in1', type => 'ns:string', attr => {'xmlns:ns' => 'http://www.w3.org/2001/XMLSchema'}, value => '20150801' ),
SOAP::Data->new(name => 'in2', type => 'ns:string', attr => {'xmlns:ns' => 'http://www.w3.org/2001/XMLSchema'}, value => '20150801' ),
SOAP::Data->new(name => 'in3', type => 'ns:ArrayOfString', attr => {'xmlns:ns' => 'https://control.akamai.com/HttpDownloadsReportService.xsd'}, value => \@columns ),
SOAP::Data->new(name => 'in4', type => 'ns:string', attr => {'xmlns:ns' => 'http://www.w3.org/2001/XMLSchema'}, value => 'ok_volume'),
SOAP::Data->new(name => 'in5', type => 'ns:UrlReportFilter', attr => {'xmlns:akaaimsdt' => 'https://control.akamai.com/Data.xsd'}, value => $filter));

 

use MIME::Parser;

use MIME::Entity;

my $parser = new MIME::Parser;

my $entity = $parser->parse_data($response);

 

# print $response;

my $data = $entity->parts(1)->stringify_body;

print $data

 

 

 

To further investigate I tried using Eclipse.  In the line:

my $response = $service->getURLForCPCode   ...

 

I put a breakpoint and took a look at what was contained in $response. It is a scalar string informing me that there was too much data. That's why I'm getting the message I'm getting. But why is it returning only a scalar?

Outcomes