googleads / googleads-php-lib

Google Ad Manager SOAP API Client Library for PHP
Apache License 2.0
656 stars 769 forks source link

SoapFault exception: [HTTP] Error Fetching http headers #503

Closed EM-MiguelRosas closed 6 years ago

EM-MiguelRosas commented 6 years ago

Hi, I posted an issue with the Report Repository on the Google DFP API forums, they redirected me here, I'm having issues getting the Download URL of the report, when I make the request using the getReportDownloadURL method from ReportService I get the following:

PHP Laravel Log:

`[2018-06-29 10:45:01] production.INFO: AdopsDfpCoordinator Searching oldest pending report [2018-06-29 10:55:19] production.ERROR: SoapFault exception: [HTTP] Error Fetching http headers in /app/shared/docroots/adops_dfp_coordinator/releases/20180604185549/vendor/googleads/googleads-php-lib/src/Google/AdsApi/Common/AdsSoapClient.php:97 Stack trace:

0 /app/shared/docroots/adops_dfp_coordinator/releases/20180604185549/vendor/googleads/googleads-php-lib/src/Google/AdsApi/Common/AdsSoapClient.php(97): SoapClient->__doRequest('<?xml version="...', 'https://ads.goo...', '', 1, 0)

1 [internal function]: Google\AdsApi\Common\AdsSoapClient->__doRequest('<?xml version="...', 'https://ads.goo...', '', 1, 0)

2 /app/shared/docroots/adops_dfp_coordinator/releases/20180604185549/vendor/googleads/googleads-php-lib/src/Google/AdsApi/Common/AdsSoapClient.php(152): SoapClient->__soapCall('getReportDownlo...', Array, NULL, Array, Array)

3 /app/shared/docroots/adops_dfp_coordinator/releases/20180604185549/vendor/googleads/googleads-php-lib/src/Google/AdsApi/Dfp/v201805/ReportService.php(96): Google\AdsApi\Common\AdsSoapClient->__soapCall('getReportDownlo...', Array)

4 /app/shared/docroots/adops_dfp_coordinator/releases/20180604185549/app/Dfp/Repositories/ReportRepository.php(130): Google\AdsApi\Dfp\v201805\ReportService->getReportDownloadURL(10160417517, 'CSV_DUMP')

5 /app/shared/docroots/adops_dfp_coordinator/releases/20180604185549/app/Dfp/Repositories/ReportRepository.php(107): Adops\Dfp\Repositories\ReportRepository->downloadReport()

6 /app/shared/docroots/adops_dfp_coordinator/releases/20180604185549/app/Dfp/Repositories/ReportRepository.php(98): Adops\Dfp\Repositories\ReportRepository->processReport()

7 /app/shared/docroots/adops_dfp_coordinator/releases/20180604185549/app/Console/Commands/ReportScheduler.php(32): Adops\Dfp\Repositories\ReportRepository->processOldestReport()

8 [internal function]: Adops\Console\Commands\ReportScheduler->handle()

9 /app/shared/docroots/adops_dfp_coordinator/releases/20180604185549/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(29): call_user_func_array(Array, Array)

10 /app/shared/docroots/adops_dfp_coordinator/releases/20180604185549/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(87): Illuminate\Container\BoundMethod::Illuminate\Container{closure}()

11 /app/shared/docroots/adops_dfp_coordinator/releases/20180604185549/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(31): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))

12 /app/shared/docroots/adops_dfp_coordinator/releases/20180604185549/vendor/laravel/framework/src/Illuminate/Container/Container.php(539): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)

13 /app/shared/docroots/adops_dfp_coordinator/releases/20180604185549/vendor/laravel/framework/src/Illuminate/Console/Command.php(182): Illuminate\Container\Container->call(Array)

14 /app/shared/docroots/adops_dfp_coordinator/releases/20180604185549/vendor/symfony/console/Command/Command.php(251): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))

15 /app/shared/docroots/adops_dfp_coordinator/releases/20180604185549/vendor/laravel/framework/src/Illuminate/Console/Command.php(167): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))

16 /app/shared/docroots/adops_dfp_coordinator/releases/20180604185549/vendor/symfony/console/Application.php(946): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

17 /app/shared/docroots/adops_dfp_coordinator/releases/20180604185549/vendor/symfony/console/Application.php(248): Symfony\Component\Console\Application->doRunCommand(Object(Adops\Console\Commands\ReportScheduler), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

18 /app/shared/docroots/adops_dfp_coordinator/releases/20180604185549/vendor/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

19 /app/shared/docroots/adops_dfp_coordinator/releases/20180604185549/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(122): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

20 /app/shared/docroots/adops_dfp_coordinator/releases/20180604185549/artisan(35): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

21 {main}

`

SOAP Log:

`[2018-06-29 10:45:02] DFP_SOAP.INFO: networkCode=4403 service=InventoryService method=getAdUnitsByStatement responseTime=186 requestId=565d077ac3267f6034c7c4dab6291a6a server=ads.google.com isFault=0 faultMessage= [2018-06-29 10:45:19] DFP_SOAP.INFO: networkCode=4403 service=ReportService method=getReportJobStatus responseTime=313 requestId=c4cd221079c997b523f2872a24cbeba8 server=ads.google.com isFault=0 faultMessage= [2018-06-29 10:50:03] DFP_SOAP.INFO: networkCode=4403 service=InventoryService method=getAdUnitsByStatement responseTime=186 requestId=ba2b09efa63a3ca5fea9c3b994617630 server=ads.google.com isFault=0 faultMessage= [2018-06-29 10:55:02] DFP_SOAP.INFO: networkCode=4403 service=InventoryService method=getAdUnitsByStatement responseTime=196 requestId=97ff4eed55fe6d672635de4fe2086423 server=ads.google.com isFault=0 faultMessage= [2018-06-29 10:55:19] DFP_SOAP.WARNING: networkCode=4403 service=ReportService method=getReportDownloadURL responseTime= requestId= server=ads.google.com isFault=1 faultMessage=Error Fetching http headers [2018-06-29 10:55:19] DFP_SOAP.NOTICE: POST /apis/ads/publisher/v201805/ReportService?wsdl HTTP/1.1^M Host: ads.google.com^M Connection: close^M User-Agent: PHP-SOAP/7.1.8^M Content-Type: text/xml; charset=utf-8^M SOAPAction: ""^M Content-Length: 615^M Authorization: REDACTED

<?xml version="1.0" encoding="UTF-8"?>

4403Evolve IQ Platform Brand Campaigns (DfpApi-PHP, googleads-php-lib/35.1.0, PHP/7.1.8)10160417517CSV_DUMP HTTP/1.1 200 OK^M Content-Type: text/xml; charset=UTF-8^M Date: Fri, 29 Jun 2018 17:45:19 GMT^M Expires: Fri, 29 Jun 2018 17:45:19 GMT^M Cache-Control: private, max-age=0^M X-Content-Type-Options: nosniff^M X-Frame-Options: SAMEORIGIN^M X-XSS-Protection: 1; mode=block^M Server: GSE^M Alt-Svc: quic=":443"; ma=2592000; v="43,42,41,39,35"^M Accept-Ranges: none^M Vary: Accept-Encoding^M Connection: close ` AUTH info: `[DFP] networkCode = "4403" applicationName = "Evolve IQ Platform Brand Campaigns" [OAUTH2] clientId = "348011291855-amje5jb8e7e66eok6q1dk1i1dij9vmai.apps.googleusercontent.com" `
fiboknacky commented 6 years ago

@thangduo Could you TAL please?

thangduo commented 6 years ago

Hi EM-MiguelRosas,

Can you please provide a link to the saved query on the DFP UI? And under what user is your application running? Please post the name of the user, not the email address. That would be enough for my lookup without exposing to risks of spam emails.

Thanks, Thang Duong

EM-MiguelRosas commented 6 years ago

I'm not building the report through the UI, but here are the parameters I'm using, and the report ID ready to download.

Report ID: 10183114003

Params: `$reportQuery = new ReportQuery();

        $reportQuery->setDimensions([
            Dimension::DATE,
            Dimension::ADVERTISER_NAME,
            Dimension::LINE_ITEM_NAME,
            Dimension::AD_UNIT_NAME,
            Dimension::MASTER_COMPANION_CREATIVE_NAME
            ]);

        $reportQuery->setColumns([
            Column::TOTAL_LINE_ITEM_LEVEL_IMPRESSIONS,
            Column::TOTAL_LINE_ITEM_LEVEL_CLICKS,
            Column::TOTAL_ACTIVE_VIEW_VIEWABLE_IMPRESSIONS,
            Column::TOTAL_ACTIVE_VIEW_MEASURABLE_IMPRESSIONS,
            Column::TOTAL_ACTIVE_VIEW_VIEWABLE_IMPRESSIONS_RATE,
            Column::TOTAL_ACTIVE_VIEW_ELIGIBLE_IMPRESSIONS,
            Column::TOTAL_ACTIVE_VIEW_MEASURABLE_IMPRESSIONS_RATE
            ]);

        $reportQuery->setAdUnitView(ReportQueryAdUnitView::HIERARCHICAL);
        $reportQuery->setDateRangeType(DateRangeType::CUSTOM_DATE);
        $reportQuery->setStartDate(DfpDateTimes::fromDateTime(
            new DateTime('-4 days', new DateTimeZone('America/Phoenix')))->getDate());
        $reportQuery->setEndDate(DfpDateTimes::fromDateTime(
            new DateTime('now', new DateTimeZone('America/Phoenix')))->getDate());

        $this->logProgress('Creating a new Report Job.');
        $reportJob = new ReportJob();

        $reportJob->setReportQuery($reportQuery);`
thangduo commented 6 years ago

Has this issue been resolved at your end? Or was it closed by accident?

YOzaz commented 6 years ago

Happening here as well.

EM-MiguelRosas commented 6 years ago

=SOLVED=

The issue is that a report job id was stuck for a large date range, and it wasn't able to fetch it, retry with another job id.