Actually, the headers is an array. So, nothing is being overwritten. This code does work in production.
The only difference I can see between the sandbox and production is the number of namespaces declared. Production has a single namespace. The soap envelope that is constructed by the PHP soap extension ends up with two namespaces declared in the XML. One namespace is production and one is the sandbox. The header vars, such as "email" end up in as <ns2:email>... Even though I only define one namespace which is the sandbox, the PHP Soap Extension must be picking out the production namespace from the sandbox wsdl. But the NuSoap based examples Google provides doesn't have that issue since the XML is not defined with the namespace designation as part of the tagname. Anyone know any work arounds for this? On Jun 24, 8:16 am, AdWords API Advisor <[email protected]> wrote: > Hi, > > Looks like you are clearing out previous headers each time your define > a new one. So, by the time "applicationToken" is loaded, the "email" > header is already overwritten. There's an example for setting > multiple request headers > athttp://stackoverflow.com/questions/589228/sending-a-soap-header-with-.... > > --Stan > > On Jun 23, 12:12 pm, jrj10 <[email protected]> wrote: > > > I am using PHP's built in SOAP extension. My test code works in > > production and I can pull down campaign info from our live account. > > The same code fails when attempting to work in the Google Sandbox. > > (Error is: The request did not contain a header named 'email'.) > > > Additionally, I can take the credentials I'm using for the sandbox and > > plug them into one of Google's NuSOAP based examples and that works > > just fine. So, I know I have the sandbox credentials correct. > > > Here's the code I'm trying (minus the login credentials) > > . > > . > > . > > $namespace = 'https://sandbox.google.com/api/adwords/v13'; > > $campWSDL = $namespace.'/CampaignService?wsdl'; > > > $client = new SoapClient( $campWSDL, array("trace"=>1) ); > > > $headers[] = new SoapHeader($namespace, 'email', $email); > > $headers[] = new SoapHeader($namespace, 'password', $password); > > $headers[] = new SoapHeader($namespace, 'clientEmail', $clientEmail); > > $headers[] = new SoapHeader($namespace, 'useragent', $useragent); > > $headers[] = new SoapHeader($namespace, 'developerToken', > > $developerToken); > > $headers[] = new SoapHeader($namespace, 'applicationToken', > > $applicationToken); > > > $client->__setSoapHeaders($headers); > > > $getAllAdWordsCampaigns = array('getAllAdWordsCampaigns' => array > > ('dummy'=>'0')); > > $result = $client->__soapCall('getAllAdWordsCampaigns', > > $getAllAdWordsCampaigns); > > print_r($result); > > > Any suggestions would be greatly appreciated. > > > Thanks, > > Joe --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
