2014-03-06 56 views
0

你好,我正在嘗試使用Google adWords API,剛開始時我遇到了一個「無效方法」的問題,即使我下面一切正常(我相信)這是我的代碼:函數(「___setSoapHeaders」)不是這個服務的有效方法

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); 

    }   
} 

這是錯誤,我回去:

PHP致命錯誤:未捕獲的SOAPFault異常:[客戶]功能(「___setSoapHeaders」)不這項服務的有效方法

我錯過了什麼G?根據The PHP Manual這是一個有效的方法。更進一步,我嘗試搜索我能想到的一切,但找不到任何東西。任何幫助是極大的讚賞!順便說一句,我運行PHP 5.3.3。

回答

1

__setSoapHeaders,只有兩個下劃線,而不是三個。

+0

我知道這將是一件愚蠢的事情......總是這樣。謝謝! – jrodichok

相關問題