Skip to content

Adwords API - Examples/AdWords/v201702 "Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL" #276

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
yacoubandkeita opened this issue Apr 14, 2017 · 29 comments
Assignees

Comments

@yacoubandkeita
Copy link

Hello Adwords Api Team,

I was trying to run 'GetCampaigns.php' and i keep receiving 'Fatal error: Uncaught SoapFault exception'. Here is what i see on my terminal:

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://adwords.google.com/api/adwords/cm/v201702/CampaignService?wsdl' : failed to load external entity "https://adwords.google.com/api/adwords/cm/v201702/CampaignService?wsdl"
in /Applications/MAMP/htdocs/paypercall-adwords-api/vendor/googleads/googleads-php-lib/src/Google/AdsApi/Common/AdsSoapClient.php:65

Stack trace:

#0 /Applications/MAMP/htdocs/paypercall-adwords-api/vendor/googleads/googleads-php-lib/src/Google/AdsApi/Common/AdsSoapClient.php(65): SoapClient->S
oapClient('https://adwords...', Array)

#1 /Applications/MAMP/htdocs/paypercall-adwords-api/vendor/googleads/googleads-php-lib/src/Google/AdsApi/AdWords/v201702/cm/CampaignService.php(144)
: Google\AdsApi\Common\AdsSoapClient->__construct('https://adwords...', Array)

#2 [internal function]: Google\AdsApi\AdWords\v201702\cm\CampaignService->__construct(Array)

#3 /Applications/MAMP/htdocs/paypercall-adwords-api/vendor/googleads/googleads-php-lib/src/Google/AdsApi/Comm in /Applications/MAMP/htdocs/paypercal
l-adwords-api/vendor/googleads/googleads-php-lib/src/Google/AdsApi/Common/AdsSoapClient.php on line 65

Can anyone help me fix this problem? Thank You.

Yacouba Keita

@fiboknacky
Copy link
Member

Hi Yacouba,

Looks like the connection problem with API servers.
Can you access https://adwords.google.com/api/adwords/cm/v201702/CampaignService?wsdl using curl or wget on your computer?

Best,
Knack

@yacoubandkeita
Copy link
Author

Hello
screen shot 2017-04-14 at 1 18 25 pm
Knack, thank you for the quick response. When i click on the link, it shows me an xml file with errors in it like:

This XML file does not appear to have any style information associated with it. The document tree is shown below.

@fiboknacky
Copy link
Member

Hi,

That's usual. It looks like it works in your browser.
Some couple things you might be able to try:

  • Can your curl in Terminal access this WSDL URL?
  • Checking your default_socket_timeout
  • Do you use any proxy settings? Could you please share what you set in adsapi_php.ini?
  • Can you try installing this library without MAMP or using other environments to see if you can run the example?

Best,
Knack

@yacoubandkeita
Copy link
Author

yacoubandkeita commented Apr 14, 2017

I just put the library on a actual live server instead of mamp, and you were right, it went through. And now it is giving me only one error :

PHP Fatal error: Class 'SoapClient' not found in /var/www/yacoubaenv/vendor/googleads-php-lib/vendor/googleads/googleads-php-lib/src/Google/AdsApi/Common/AdsSoapClient.php on line 30

Do have you something for that?


adsapi_php.ini :

[ADWORDS]
; Required AdWords API properties. Details can be found at:
; https://developers.google.com/adwords/api/docs/guides/basic-concepts#soap_and_xml
developerToken = " iu ********** "
clientCustomerId = " 475- ********* "

; Optional. Set a friendly application name identifier.
userAgent = "Development"

; Optional additional AdWords API settings.
; endpoint = "https://adwords.google.com/"
; isPartialFailure = false

; Optional setting for utility usage tracking in the user agent in requests.
; Defaults to true.
; includeUtilitiesInUserAgent = true

[ADWORDS_REPORTING]
; Optional reporting settings.
; isSkipReportHeader = false
; isSkipColumnHeader = false
; isSkipReportSummary = false
; isUseRawEnumValues = false

[OAUTH2]
; Required OAuth2 credentials. Uncomment and fill in the values for the
; appropriate flow based on your use case. See the README for guidance:
; https://github.com/googleads/googleads-php-lib/blob/master/README.md#getting-started

; For installed application or web application flow.
clientId = "830627224098-915mmvms36dnt50r68slogepvcgr4412.apps.googleusercontent.com"
clientSecret = "ahsKKAcu2SsOogHZG1iaVAEK"
refreshToken = "4/ytfhty ***********"

; For service account flow.
; jsonKeyFilePath = "INSERT_ABSOLUTE_PATH_TO_OAUTH2_JSON_KEY_FILE_HERE"
; scopes = "https://www.googleapis.com/auth/adwords"
; impersonatedEmail = "INSERT_EMAIL_OF_ACCOUNT_TO_IMPERSONATE_HERE"

[SOAP]
; Optional SOAP settings. See SoapSettingsBuilder.php for more information.
; compressionLevel = <COMPRESSION_LEVEL>
; wsdlCache = <WSDL_CACHE>

[PROXY]
; Optional proxy settings to be used by SOAP requests.
; host = ""
; port =
; user = ""
; password = ""

[LOGGING]
; Optional logging settings.
; soapLogFilePath = "path/to/your/soap.log"
; soapLogLevel = "INFO"
; reportDownloaderLogFilePath = "path/to/your/report-downloader.log"
; reportDownloaderLogLevel = "INFO"
; batchJobsUtilLogFilePath = "path/to/your/bjutil.log"
; batchJobsUtilLogLevel = "INFO"

Thank you Knack!

Y.Keita

@fiboknacky
Copy link
Member

Hello Keita,

First, please hide your above refresh tokens as well.

SoapClient is a PHP SOAP toolkit, which should be installed in your system before using our library and API.
Now the issue is that this toolkit seems not installed properly.
Could you please consult http://php.net/manual/en/class.soapclient.php to see if your PHP SOAP toolkit is installed properly?

Best,
Knack

@yacoubandkeita
Copy link
Author

yacoubandkeita commented Apr 14, 2017

Hello Knack,

After i installed SOAP toolkit, the program was able to see my info, but didn't retrieve the campaigns

Here is my console result :

2017-04-14 21:44:56] AW_SOAP.WARNING: clientCustomerId= ****** operations=1 service=CampaignService method=get responseTime=131 requestId=00054d275a35a2680a37464aef037a4c server=adwords.google.com isFault=1 faultMe
ssage=[QuotaCheckError.DEVELOPER_TOKEN_NOT_APPROVED @ ; trigger:'']
[2017-04-14 21:44:56] AW_SOAP.NOTICE: POST /api/adwords/cm/v201702/CampaignService?wsdl HTTP/1.1
Host: adwords.google.com
Connection: Keep-Alive
User-Agent: PHP-SOAP/7.1.4-1+deb.sury.org~xenial+1
Content-Type: text/xml; charset=utf-8
SOAPAction: ""
Content-Length: 951
Authorization: REDACTED

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://adwords.google.com/api/adwords/cm/v201702">SOAP-ENV:Headerns1:RequestHeaderns1:clientCustomerId *******</ns1:clie
ntCustomerId>ns1:developerTokenREDACTED</ns1:developerToken>ns1:userAgentEwebify_Development (AwApi-PHP, googleads-php-lib/25.4.0, PHP/7.1.4-1+deb.sury.org~xenial+1)</ns1:userAgent>ns1:validateOnlyfalse</ns1:valida
teOnly>ns1:partialFailurefalse</ns1:partialFailure></ns1:RequestHeader></SOAP-ENV:Header>SOAP-ENV:Bodyns1:getns1:serviceSelectorns1:fieldsId</ns1:fields>ns1:fieldsName</ns1:fields>ns1:orderingns1:fieldNam
e</ns1:field>ns1:sortOrderASCENDING</ns1:sortOrder></ns1:ordering>ns1:pagingns1:startIndex0</ns1:startIndex>ns1:numberResults500</ns1:numberResults></ns1:paging></ns1:serviceSelector></ns1:get></SOAP-ENV:Body></S
OAP-ENV:Envelope>

HTTP/1.1 500 Internal Server Error
Content-Type: text/xml; charset=UTF-8
Date: Fri, 14 Apr 2017 21:44:56 GMT
Expires: Fri, 14 Apr 2017 21:44:56 GMT
Cache-Control: private, max-age=0
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Server: GSE
Alt-Svc: quic=":443"; ma=2592000; v="37,36,35"
Accept-Ranges: none
Vary: Accept-Encoding
Transfer-Encoding: chunked

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">soap:Header00054d275a35a2680a37464aef037a4cCampaignServiceget1131</soap:Header>soap:Bodysoap:Faultsoap:Server<faultstring

[QuotaCheckError.DEVELOPER_TOKEN_NOT_APPROVED @ ; trigger:'<null>'][QuotaCheckError.DEVELOPER_TOKEN_NOT_A
PPROVED @ ; trigger:'<null>']<ApplicationException.Type>ApiException</ApplicationException.Type></fieldP
ath><null>QuotaCheckError.DEVELOPER_TOKEN_NOT_APPROVED<ApiError.Type>QuotaCheckError</ApiError.Type>DEVELOPER_TOKEN_NOT_APPROVED</ApiException
Fault></soap:Fault></soap:Body></soap:Envelope>

PHP Fatal error: Uncaught Google\AdsApi\AdWords\v201702\cm\ApiException: [QuotaCheckError.DEVELOPER_TOKEN_NOT_APPROVED @ ; trigger:''] in /var/www/yacoubaenv/vendor/googleads-php-lib/vendor/googleads/googleads-php
-lib/src/Google/AdsApi/Common/Util/Reflection.php:39
Stack trace:
#0 /var/www/yacoubaenv/vendor/googleads-php-lib/vendor/googleads/googleads-php-lib/src/Google/AdsApi/Common/Util/Reflection.php(39): ReflectionClass->newInstanceArgs(Array)
#1 /var/www/yacoubaenv/vendor/googleads-php-lib/vendor/googleads/googleads-php-lib/src/Google/AdsApi/Common/AdsSoapClient.php(162): Google\AdsApi\Common\Util\Reflection->createInstance('Google\AdsApi\A...', Array)
#2 /var/www/yacoubaenv/vendor/googleads-php-lib/vendor/googleads/googleads-php-lib/src/Google/AdsApi/Common/AdsSoapClient.php(126): Google\AdsApi\Common\AdsSoapClient->parseApiExceptionFromSoapFault(Object(SoapFault))
#3 /var/www/yacoubaenv/vendor/googleads-php-lib/vendor/googleads/googleads-php-lib/src/Google/AdsApi/AdWords/v201702/cm/CampaignService.php(156): Goo in /var/www/yacoubaenv/vendor/googleads-php-lib/vendor/googleads/googl
eads-php-lib/src/Google/AdsApi/Common/Util/Reflection.php on line 39

@fiboknacky
Copy link
Member

Hi Keita,

As the error message suggested, your developer token hasn't been approved yet.
This is the part of the process needed for start using the AdWords API as described here.

I recommend to go through the Sign Up guide and Make Your First API Call again.

If you have questions about developer tokens or the API in general, feel free to reach out at https://groups.google.com/forum/#!forum/adwords-api.

Best,
Knack

@yacoubandkeita
Copy link
Author

yacoubandkeita commented Apr 15, 2017 via email

@fiboknacky fiboknacky self-assigned this May 2, 2017
@adhippatil
Copy link

Hello AdWords API team,
I am running 'GetCampaigns.php' from terminal ,it is showing the list of campaigns. But when I ran it on web browser, it is giving me an error :
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://adwords.google.com/api/adwords/cm/v201705/CampaignService?wsdl' : failed to load external entity "https://adwords.google.com/api/adwords/cm/v201705/CampaignService?wsdl" in /opt/lampp/htdocs/googleads-php-lib/src/Google/AdsApi/Common/AdsSoapClient.php:65 Stack trace: #0 /opt/lampp/htdocs/googleads-php-lib/src/Google/AdsApi/Common/AdsSoapClient.php(65): SoapClient->SoapClient('https://adwords...', Array) #1 /opt/lampp/htdocs/googleads-php-lib/src/Google/AdsApi/AdWords/v201705/cm/CampaignService.php(145): Google\AdsApi\Common\AdsSoapClient->__construct('https://adwords...', Array) #2 [internal function]: Google\AdsApi\AdWords\v201705\cm\CampaignService->__construct(Array) #3 /opt/lampp/htdocs/googleads-php-lib/src/Google/AdsApi/Common/Util/Reflection.php(39): ReflectionClass->newInstanceArgs(Array) #4 /opt/lampp/htdocs/googleads-php-lib/src/Google/AdsApi/Common/AdsSoapClientFactory.php(86): Google\AdsApi\Common\Util\Refl in /opt/lampp/htdocs/googleads-php-lib/src/Google/AdsApi/Common/AdsSoapClient.php on line 65

What should I do to see it running in the web browser also? Please help me!

@kennblvnp
Copy link

Could someone please answer @adhippatil thank you!

@fiboknacky
Copy link
Member

Hello @adhippatil

The code example is meant to run on terminal only so you might get correct results when running on the browser.
Having said that, your problem might occur from the different version of PHP, and hence different version of settings including SSL CA files.

In your case, if it fails always, it may hint that your CA file isn't valid or isn't found.
Could you please check this wiki for troubleshooting?

Best,
Knack

@kennblvnp
Copy link

Windows 10 with 32 and 64 bit of course. Xamp 3.2. PHP 7.1.

Which of these is causing the problem? Its really annoying I can't solve it.

@fiboknacky
Copy link
Member

Could you please check this wiki?
Based on what I've seen in other cases, it's likely because of SSL CA file issues.

@kennblvnp
Copy link

kennblvnp commented Dec 5, 2017

@fiboknacky checking on it.

I have no problem with Mac, I am using Mamp pro 4 which is already built in with SSL CA. Now I am on windows development.

Ill let you know how it was solved, hopefully. Thank you for responding so quickly!

@fiboknacky
Copy link
Member

I've got many reports about issues with CA files on Windows PHP. :(
So I guess that your case would be one of them.
Please let me know if you can solve the problem. :)

@kennblvnp
Copy link

I have checked this

I can't find my crt.

For Windows, the path to the CA file is usually either C:\windows\system32\curl-ca-bundle.crt or C:\windows\curl-ca-bundle.crt.

@kennblvnp
Copy link

@fiboknacky where can I download a curl-ca-bundle.crt file?

@kennblvnp
Copy link

@fiboknacky I got it

If you don't have any CA files in your system, download one from curl's website and put it in either the default path above (recommended) or your usual place for them.

[https://curl.haxx.se/docs/caextract.html](Can be downloaded here) but its in pem file...

@fiboknacky
Copy link
Member

@kennblvnp

As described in the wiki,

If you don't have any CA files in your system, download one from curl's website and put it in either the default path above (recommended) or your usual place for them.

Could you follow the link please?

@kennblvnp
Copy link

Its in pem file... im looking for crt.

@fiboknacky
Copy link
Member

It should be very similar. Could you try it first?
See this post.

@kennblvnp
Copy link

kennblvnp commented Dec 6, 2017

I do not know where to download curl.exe.

I tried to download this zip https://curl.haxx.se/latest.cgi?curl=tar.bz2

then extract it, I can't find .exe file.

@fiboknacky
Copy link
Member

Sorry I wasn't clear. What I would like you to see is the step 4 in the post:

Rename the cacert.pem file to curl-ca-bundle.crt

So, you probably could rename the file and use it as .crt file.
You don't need to follow other steps.

Then try moving the file to either of the following:

  • C:\windows\system32\
  • C:\windows\
  • C:\Windows\SysWOW64 (If you use 32-bit Windows 7)

@kennblvnp
Copy link

Okay i did what you ask me. The error still showing. I even restart my xamp.

@kennblvnp
Copy link

Check out my php.ini

[curl]
; A default value for the CURLOPT_CAINFO option. This is required to be an
; absolute path.
curl.cainfo="C:\xampp\apache\bin\curl-ca-bundle.crt"

@fiboknacky
Copy link
Member

What is the result after specifying path to your CA file? Still same errors?
Have you tried openssl.cafile too?

@kennblvnp
Copy link

I tried to change path curl.cainfo.

curl.cainfo="C:\xampp\apache\bin\curl-ca-bundle.crt"
curl.cainfo="C:\windows\system32\curl-ca-bundle.crt"
curl.cainfo="C:\windows\curl-ca-bundle.crt"
curl.cainfo="C:\Windows\SysWOW64\curl-ca-bundle.crt"

Doesn't work.

But this one works perfectly!!! :
openssl.cafile="C:\xampp\apache\bin\curl-ca-bundle.crt"

@kennblvnp
Copy link

kennblvnp commented Dec 7, 2017

This is for PHP 7.1, Xampp 3.2.2, Windows 10 64x/32x.

Steps:

  1. download pem file here https://curl.haxx.se//ca/cacert-2017-09-20.pem
  2. rename Rename the cacert-2017-09-20.pem file to curl-ca-bundle.crt
  3. copy - paste - replace at C:\xampp\apache\bin\
  4. open php.ini and find openssl.cafile, uncomment and provide path for curl-ca-bundle.crt
    example: openssl.cafile="C:\xampp\apache\bin\curl-ca-bundle.crt"
  5. restart xamp

This is solve! Mine is working now. Thanks!

@fiboknacky
Copy link
Member

Thanks for replying back and for helping summarizing the steps for other users. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants