Re: PHP5 + Adwords API: scheduleReportJob = no go!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 20 Jan 2006, Ken Chau wrote:

> I tried to simply schedule a report job from ext/soap with the code below...
> All it would do is tell me that I'm "missing default constructor." Here lies
> the rub - I have to specify the job's xsi:type to "KeywordReportJob" - but
> where do I do that in PHP5 ext/soap? (answer does NOT lie in documentation).
> Also, if I were to manually do a __doRequest, I realized that the xmlns:xsi
> namespace isn't set in the SOAP envelope! Any help?

I figured out how to add the xsi:type attribute, but Google is still
rejecting the response. I pulled up NuSOAP to get a copy their working
example so I could compare the XML. It looks like the XML should be
equivalent to me, even if it's formatted differently, so I can't tell
if I'm wrong or Google is broken. :)

Anyway, I'll get you part of the way there, and if you want to
continue the debugging or hack the XML via __doRequest, go ahead:

> <?php
>
> $ns = 'https://adwords.google.com/api/adwords/v2';
> $headers[] = new SoapHeader($ns, 'email', 'x');
> $headers[] = new SoapHeader($ns, 'clientEmail', 'x');
> $headers[] = new SoapHeader($ns, 'password', 'x');
> $headers[] = new SoapHeader($ns, 'useragent', 'x');
> $headers[] = new SoapHeader($ns, 'token', 'x');
>
> $client  = new SoapClient("
> https://adwords.google.com/api/adwords/v2/ReportService?wsdl";, array("trace"
> => 1));
> $client->__setSoapHeaders($headers);

// Your data here
$data = array("name"  => 'keyword report test',
                          "aggregationType" => 'Summary',
                          "startDate"       => '2005-04-01T00:00:00Z',
                          "endDate"         =>  '2005-04-30T00:00:00Z');

// Make a SOAPVar to explicitly set this information
$ReportJob['job'] = new SOAPVar($data, SOAP_ENC_OBJECT, 'KeywordReportJob');

$response = $client->scheduleReportJob($ReportJob);

-adam

-- 
adam@trachtenberg.com | http://www.trachtenberg.com
author of o'reilly's "upgrading to php 5" and "php cookbook"
avoid the holiday rush, buy your copies today!

-- 
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Kernel Newbies]     [PHP Database]     [Yosemite]

  Powered by Linux