i am trying to build the header like that but without any success.
$soapHeaders = '<soapenv:Envelope>'
.'<soapenv:Header>'
.'<v13:email>'.$email.'</v13:email>'
.'<v13:password>'.$password.'</v13:password>'
.'<v13:clientEmail>'.$client_email.'</v13:clientEmail>'
.'<v13:useragent>'.$useragent.'</v13:useragent>'
.'<v13:developerToken>'.$developer_token.'</v13:developerToken>'
.'<v13:applicationToken>'.$application_token.'</
v13:applicationToken>'
.'</soapenv:Header>'
.'<soapenv:Body>'
.'</soapenv:Body>'
.'</soapenv:Envelope>';
$namespace = 'https://sandbox.google.com/api/adwords/v13';
$client = new SoapClient('https://sandbox.google.com/api/adwords/v13/
ReportService?wsdl');
$client->__setSoapHeaders($soapHeaders);
This gives me
PHP Fatal error: SoapClient::__setSoapHeaders(): Invalid SOAP header
in /srv/dev11/current/tools/scripts/marketing/google_adword_report.php
on line 46
Could you please show how to do this with php _setSoapHeaders
AdWords API Advisor wrote:
> Hi,
>
> The v13 API doesn't use a RequestHeader element to wrap the header
> values. Instead each header value is it's own SOAP header.
>
> <soapenv:Envelope ...>
> <soapenv:Header>
> <v13:email>...</v13:email>
> <v13:password>...</v13:password>
> ...
> </soapenv:Header>
> <soapenv:Body>
> ...
> </soapenv:Body>
> </soapenv:Envelope>
>
> Best,
> - Eric Koleda, AdWords API Team
>
> On Dec 14, 6:25 pm, cvijayarenu <[email protected]> wrote:
> > I am trying with this code.
> >
> > $options = array ('email' => $email,
> >
> > 'password' => $password,
> >
> > 'clientEmail' => $client_email,
> >
> > 'useragent' => $useragent,
> >
> > 'developerToken' => $developer_token,
> >
> > 'applicationToken' => $application_token
> >
> > );
> >
> > $namespace = 'https://adwords.google.com/api/adwords/v13';
> >
> > $client = new SoapClient(
> > 'https://sandbox.google.com/api/adwords/v13/ReportService?wsdl',
> >
> > array(
> >
> > 'features' => SOAP_SINGLE_ELEMENT_ARRAYS,
> >
> > 'encoding' => 'utf-8'
> >
> > ));
> >
> > $header = new SoapHeader($namespace, 'RequestHeader', $options);
> >
> > $client->__setSoapHeaders($header);
> >
> > try {
> >
> > var_dump($client->getAllJobs());
> >
> > }
> >
> > catch (Exception $ex)
> >
> > {
> >
> > echo $ex->getMessage();
> >
> > var_dump($client->__getLastRequestHeaders());
> >
> > }
> >
> > I get this error.
> >
> > The request did not contain a header named 'email'.NULL
> >
> > How do i set the headers in the proper way?
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
http://adwordsapi.blogspot.com
http://groups.google.com/group/adwords-api
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en