Error

150 views
Skip to first unread message

alek...@prodex.net.ua

unread,
Jul 19, 2017, 5:14:46 AM7/19/17
to AdWords API Forum
Hello, I have error:

Fatal error:  Uncaught Error: Call to a member function generateHttpHeaders() on null in

My code:
    
    $BudgetOrderService = new BudgetOrderService();
    $page = $BudgetOrderService->getBillingAccounts();

How i can fix it?

Sreelakshmi Sasidharan (AdWords API Team)

unread,
Jul 19, 2017, 11:47:47 AM7/19/17
to AdWords API Forum
Hi, 

Could you please enable logging and share the complete SOAP logs of your API operation? Also, please confirm that you are setting Authorization, developerToken, userAgent and clientCustomerId in the request header. If you are using our client library, you can go through this section to understand how to set OAuth2Credential and the session prior to making the API call. 

Thanks,
Sreelakshmi, AdWords API Team

alek...@prodex.net.ua

unread,
Jul 28, 2017, 4:52:26 AM7/28/17
to AdWords API Forum
Where can I see an example of this method implementation?

среда, 19 июля 2017 г., 18:47:47 UTC+3 пользователь Sreelakshmi Sasidharan (AdWords API Team) написал:

Sreelakshmi Sasidharan (AdWords API Team)

unread,
Jul 28, 2017, 2:49:12 PM7/28/17
to AdWords API Forum
Hi, 

Are you looking for a code sample for BudgetOrderService? If so, we don't have a documented sample for this service. You can refer to the code snippets in this guide to understand how to perform various operations. You can also find the complete set of code samples in PHP here

alek...@prodex.net.ua

unread,
Jul 31, 2017, 8:42:41 AM7/31/17
to AdWords API Forum
Happened. But Now another problem.
GetBillingAccounts returns null

my code:
$oAuth2Credential = (new OAuth2TokenBuilder())
        ->fromFile()
        ->build();
global $clientCustomerId;

$session = (new AdWordsSessionBuilder())
        ->fromFile()
        ->withOAuth2Credential($oAuth2Credential)->withClientCustomerId($clientCustomerId)
        ->build();
$AdWordsHeaderHandler = new AdWordsHeaderHandler();
$AdWordsHeaderHandler->generateHttpHeaders($session);
$SoapLogMessageFormatter = new SoapLogMessageFormatter();
$AdWordsServiceDescriptor = new AdWordsServiceDescriptor(BudgetOrderService::class);

$AdsSoapClientFactory = new AdsSoapClientFactory($SoapLogMessageFormatter);
$soapClient = $AdsSoapClientFactory->generateSoapClient($session, $AdWordsHeaderHandler, $AdWordsServiceDescriptor);

var_dump($soapClient->getBillingAccounts());


пятница, 28 июля 2017 г., 21:49:12 UTC+3 пользователь Sreelakshmi Sasidharan (AdWords API Team) написал:

Sreelakshmi Sasidharan (AdWords API Team)

unread,
Jul 31, 2017, 1:44:48 PM7/31/17
to AdWords API Forum
Hi, 

Would you be able to share the SOAP logs for this operation along with the clientCustomerId in the request header? If you haven't enabled logging yet, please check my previous post for the guide to enable logging. 
Reply all
Reply to author
Forward
0 new messages