Re: [SOAP] PHP5 + Adwords API: scheduleReportJob = no go!
| From: | Adam Maccabee Trachtenberg | Date: | Sat, 21 Jan 2006 18:54:26 +0000 |
| Subject: | Re: [SOAP] PHP5 + Adwords API: scheduleReportJob = no go! | ||
| References: | 1 | Groups: | php.soap |
| Request: | Send a blank email to php-soap+get-2096@lists.php.net to get a copy of this message | ||
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!