Hi,

I'm facing a problem in using  getAllAdWordsCampaigns() and
getCampaign
() methods of Campaign Service on SandBox. Whenever I called those
methods it leads to exception of null although I set everything about
the AdwordsUser correctly. Could u please help me?

Code is -

require_once('soapclientfactory.php');

# Provide AdWords login information.
$email = '[email protected]';
$password = 'XXXXXXX';
$client_email = '[email protected]';
$useragent = 'Mozilla';
$developer_token = '[email protected]++gbp';

# Define SOAP headers.
$headers =
  '<email>' . $email . '</email>'.
  '<password>' . $password . '</password>' .
  '<clientEmail>' . $client_email . '</clientEmail>' .
  '<useragent>' . $useragent . '</useragent>' .
  '<developerToken>' . $developer_token . '</developerToken>';

# Set up service connection. To view XML request/response, change
value of
# $debug to 1. To send requests to production environment, replace
# "sandbox.google.com" with "adwords.google.com".
$namespace = 'https://sandbox.google.com/api/adwords/v13';
$campaign_service =
  SoapClientFactory::GetClient($namespace . '/CampaignService?wsdl',
'wsdl');
$campaign_service->setHeaders($headers);
$debug = 1;

# Get all campaigns.
$request_xml ="<getAllAdWordsCampaigns><dummy>0</dummy></
getAllAdWordsCampaigns>";
$campaigns = $campaign_service->call('getAllAdWordsCampaigns',
$request_xml);
echo "<pre>";
$campaigns = $campaigns['getAllAdWordsCampaignsReturn'];
if ($debug) show_xml($campaign_service);
if ($campaign_service->fault) show_fault($campaign_service);

# Convert to a list if we get back a single object.
if (!$campaigns[0]) {
  $campaigns = array($campaigns);
}

# Display campaign info.
for ($i = 0; $i < count($campaigns); $i++) {
  echo 'Campaign name is "' . $campaigns[$i]['name'] . '" id is "' .
    $campaigns[$i]['id'] . '".' . "\n";
}

function show_xml($service) {
  echo $service->request;
  echo $service->response;
  echo "\n";
}

function show_fault($service) {
  echo "\n";
  echo 'Fault: ' . $service->fault . "\n";
  echo 'Code: ' . $service->faultcode . "\n";
  echo 'String: ' . $service->faultstring . "\n";
  echo 'Detail: ' . $service->faultdetail . "\n";
  exit(0);
}

Error is ---

<?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:xsi="http://
www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://
schemas.xmlsoap.org/soap/encoding/" xmlns:ns2333="http://
tempuri.org"><SOAP-ENV:Header><email>[email protected]</
email><password>XXXXXXXX</
password><clientEmail>[email protected]</
clientEmail><useragent>Mozilla</
useragent><developerToken>[email protected]++gbp</developerToken></
SOAP-ENV:Header><SOAP-ENV:Body><getAllAdWordsCampaigns><dummy>0</
dummy></getAllAdWordsCampaigns></SOAP-ENV:Body></SOAP-
ENV:Envelope>HTTP/1.1 200 OK
Content-Type: text/xml; charset=iso-8859-1
Date: Wed, 22 Apr 2009 08:47:35 GMT
Expires: Wed, 22 Apr 2009 08:47:35 GMT
Cache-Control: private, max-age=0
X-Content-Type-Options: nosniff
Content-Length: 998
Server: GFE/2.0

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/
envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
 <soapenv:Header>
  <responseTime soapenv:actor="http://schemas.xmlsoap.org/soap/actor/
next" soapenv:mustUnderstand="0" xmlns="https://adwords.google.com/api/
adwords/v13">53</responseTime>
  <operations soapenv:actor="http://schemas.xmlsoap.org/soap/actor/
next" soapenv:mustUnderstand="0" xmlns="https://adwords.google.com/api/
adwords/v13">1</operations>
  <units soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next";
soapenv:mustUnderstand="0" xmlns="https://adwords.google.com/api/
adwords/v13">1</units>
  <requestId soapenv:actor="http://schemas.xmlsoap.org/soap/actor/
next" soapenv:mustUnderstand="0" xmlns="https://adwords.google.com/api/
adwords/v13">ab2178691ebc7fd54d8602f3fa464ff8</requestId>
 </soapenv:Header>
 <soapenv:Body>
  <getAllAdWordsCampaignsResponse xmlns=""/>
 </soapenv:Body>
</soapenv:Envelope>

PHP Notice:  Uninitialized string offset:  0

Campaign name is "" id is "".

Thanks
PPL

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to