Setting up the API, getting a SOAP error

736 views
Skip to first unread message

mar...@pulsecomms.com

unread,
Dec 12, 2017, 5:53:10 AM12/12/17
to AdWords API Forum
Hello, I've been setting up the adwords api so I can write some scripts to automate some of our processes. I managed to get the starting bits done (developer token, test account, oauth2, etc) and configured it so that they run in PHP. I get to the moment of truth and try to run a script, but I keep on getting the same error regardless of the script I run.

Fatal error: Uncaught SoapFault exception: [HTTP] Could not connect to host in C:\xampp\htdocs\adwords\vendor\googleads\googleads-php-lib\src\Google\AdsApi\Common\AdsSoapClient.php:90

Stack trace:
#0 C:\xampp\htdocs\adwords\vendor\googleads\googleads-php-lib\src\Google\AdsApi\Common\AdsSoapClient.php(90): SoapClient->__doRequest('<?xml version="...', 'https://adwords...', '', 1, 0)
#1 [internal function]: Google\AdsApi\Common\AdsSoapClient->__doRequest('<?xml version="...', 'https://adwords...', '', 1, 0)
#2 C:\xampp\htdocs\adwords\vendor\googleads\googleads-php-lib\src\Google\AdsApi\Common\AdsSoapClient.php(131): SoapClient->__soapCall('get', Array, NULL, Array, Array)
#3 C:\xampp\htdocs\adwords\vendor\googleads\googleads-php-lib\src\Google\AdsApi\AdWords\v201710\cm\CampaignService.php(158): Google\AdsApi\Common\AdsSoapClient->__soapCall('get', Array)
#4 C:\xampp\htdocs\adwords\test.php(51): Google\AdsApi\AdWords\v201710\cm\CampaignService->get(Object(Google\AdsApi\AdWords\v201710\cm\Selector))
#5 C:\xampp\htdocs\adwords in C:\xampp\htdocs\adwords\vendor\googleads\googleads-php-lib\src\Google\AdsApi\Common\AdsSoapClient.php on line 90

These are my php.ini SOAP settings:

[soap]
; Enables or disables WSDL caching feature.
; http://php.net/soap.wsdl-cache-enabled
soap
.wsdl_cache_enabled=0

; Sets the directory name where SOAP extension will put cache files.
; http://php.net/soap.wsdl-cache-dir
soap
.wsdl_cache_dir="/tmp"

; (time to live) Sets the number of second while cached file will be used
; instead of original one.
; http://php.net/soap.wsdl-cache-ttl
soap
.wsdl_cache_ttl=86400

; Sets the size of the cache limit. (Max. number of WSDL files to cache)
soap
.wsdl_cache_limit=5

I'm not sure how to approach this, there isn't much on the internet about it. Did anyone come across the same situation? Is it because I'm running it on xampp rather than something else?

Sreelakshmi Sasidharan (AdWords API Team)

unread,
Dec 12, 2017, 2:23:50 PM12/12/17
to AdWords API Forum
Hi, 

It does seem like an issue related to the network. I see that you already tried setting the "wsdl_cache_enabled". Could you check this thread on the StackOverflow with other suggestions about this issue? It might be helpful in checking your SSL CA file as described in this wiki as well. If either of this does not help, could you please create a new issue on the PHP client libraries issue tracker? The library owner might be able to suggest a fix. 

Thanks,
Sreelakshmi, AdWords API Team

mar...@pulsecomms.com

unread,
Dec 14, 2017, 11:38:00 AM12/14/17
to AdWords API Forum
Thanks! I copied the code to an online server and it seems to work now. It's probably an issue with my local PC/XAMPP.

Alan Coleman

unread,
Feb 5, 2018, 9:43:15 AM2/5/18
to AdWords API Forum
Hi there,

Did you managed to get this issue sorted in your local development environment? I'm having the same issue locally and really need to develop using localhost before pushing live.

Thanks

Sreelakshmi Sasidharan (AdWords API Team)

unread,
Feb 5, 2018, 1:50:08 PM2/5/18
to AdWords API Forum
Hi Alan, 

Could you please share your error logs? If it has any sensitive information, please use reply privately to author while sharing the logs. 

Alan Coleman

unread,
Feb 6, 2018, 5:00:00 AM2/6/18
to AdWords API Forum
Thanks for the reply Sreelakshmi,

As a local test I disabled the SOAP SSL Verification in SoapSettingsBuilder.php, this allowed me to run an example via the command line. So the problem is with the certs, or lack of them, on my local machine.

Thanks again for your help.

Sreelakshmi Sasidharan (AdWords API Team)

unread,
Feb 6, 2018, 10:36:19 AM2/6/18
to AdWords API Forum
Hi Alan, 

Glad that it worked for you. The guide on troubleshooting CA file issues might be helpful for you. Let me know if you need any further assistance. 
Reply all
Reply to author
Forward
0 new messages