__setSoapHeaders, only two underscores, not three.
Function ("___setSoapHeaders") is not a valid method for this service
-
10-06-2023 - |
Question
Hello I am trying to work with the Google adWords API and just at the start I am running into an issue of having an "invalid method" even though I am following everything correctly (I believe) Here is my code:
ini_set("soap.wsdl_cache_enabled",0);
class adwords {
protected $server = "###";
protected $version = "###";
protected $email = "###";
protected $password = "###";
protected $auth_key = "###";
protected $dev_key = "###";
protected $ua = "###";
protected $client_id = ###;
public function __construct() {
$this->campaign_service();
}
public function campaign_service() {
$service = "CampaignService";
$options = array(
'encoding' => 'utf-8',
'features' => SOAP_SINGLE_ELEMENT_ARRAYS
);
$wsdl = "{$this->server}/{$this->version}/{$service}?wsdl";
$namespace = "###";
$header = array(
'authToken' => $this->auth_key,
'clientCustomerId' => $this->client_id,
'userAgent' => $this->ua,
'developerToken' => $this->dev_key
);
$client = new SoapClient($wsdl,$options);
$headers = new SoapHeader($namespace,"RequestHeader",$header,false);
$client->___setSoapHeaders($headers);
}
}
This is the error I get back:
PHP Fatal error: Uncaught SoapFault exception: [Client] Function ("___setSoapHeaders") is not a valid method for this service
Am I missing something? According to The PHP Manual this is a valid method. Further more I tried searching everything I could think of about this but cannot find anything. Any help is greatly appreciated! I am running PHP 5.3.3 by the way.
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow