Shwetha, Yes I'm using the AdWords API Java client library. Here is my command to execute the application: java -cp /hadoop/user/findlaw/jars/adwords/AdWordsApi.jar com.findlaw.adwords.AdWordsApiApplication -Dhttp.proxyHost=webproxy.h.corp.services -Dhttp.proxyPort=80 -Dhttps.proxyHost=webproxy.h.corp.services -Dhttps.proxyPort=80 /project/findlaw/etl/adwords/AdPerformanceReport.csv /project/findlaw/data/adwords/AdPerformanceReport/year=2016 0
On Friday, September 30, 2016 at 1:22:47 PM UTC-5, christophe...@thomsonreuters.com wrote: > > > Okay, I'm stuck authenticating to the Google API and looking for ideas. I > have tried so many suggestions from the web but none seem to get me past > the connection issue. > > I am waiting to talk to a Linux admin to see if the proxy is blocking > outbound requests to Google, but I thought I would post a question here to > maybe learn something else I'm missing. > > Thanks for any advice. > > > > If I created the following cURL command correctly, the following is what > happens when I run it from the Linux command line. > > Note: I did also add "-x http://webproxy.h.corp.services:80" to the cURL > to explicitly set the proxy > > The parameters are the same as I use in a Java test HTTP post that works > just fine on my local workstation (see below) so the “Required parameter….” > error I believe is misleading. > > > > curl -v -k -x http://webproxy.h.corp.services:80 --header "Content-Type: > application/x-www-form-urlencoded" \ > > > -F 'grant_type=refresh_token' \ > > > -F 'refresh_token=1/hDGjsPYJd0WQbFlX******************' \ > > > -F 'client_id=628259514038-********************. > apps.googleusercontent.com' \ > > > -F 'client_secret=*****************' \ > > > https://accounts.google.com/o/oauth2/token > > > > * About to connect() to proxy webproxy.h.corp.services port 80 (#0) > > * Trying 163.231.26.134... connected > > * Connected to webproxy.h.corp.services (163.231.26.134) port 80 (#0) > > * Establish HTTP proxy tunnel to accounts.google.com:443 > > > CONNECT accounts.google.com:443 HTTP/1.1 > > > Host: accounts.google.com:443 > > > User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 > NSS/3.21 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2 > > > Proxy-Connection: Keep-Alive > > > > > < HTTP/1.0 200 Connection established > > < > > * Proxy replied OK to CONNECT request > > * Initializing NSS with certpath: sql:/etc/pki/nssdb > > * warning: ignoring value of ssl.verifyhost > > * skipping SSL peer certificate verification > > * SSL connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 > > * Server certificate: > > * subject: CN=accounts.google.com,O=Google Inc,L=Mountain > View,ST=California,C=US > > * start date: Sep 14 08:44:36 2016 GMT > > * expire date: Dec 07 08:19:00 2016 GMT > > * common name: accounts.google.com > > * issuer: CN=Google Internet Authority G2,O=Google Inc,C=US > > > POST /o/oauth2/token HTTP/1.1 > > > User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 > NSS/3.21 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2 > > > Host: accounts.google.com > > > Accept: */* > > > Content-Length: 601 > > > Expect: 100-continue > > > Content-Type: application/x-www-form-urlencoded; > boundary=----------------------------8c681bcd32df > > > > > * Done waiting for 100-continue > > < HTTP/1.1 400 Bad Request > > < Content-Type: application/json; charset=utf-8 > > < Cache-Control: no-cache, no-store, max-age=0, must-revalidate > > < Pragma: no-cache > > < Expires: Mon, 01 Jan 1990 00:00:00 GMT > > < Date: Fri, 30 Sep 2016 13:05:52 GMT > > < X-Content-Type-Options: nosniff > > < X-Frame-Options: SAMEORIGIN > > < X-XSS-Protection: 1; mode=block > > < Server: GSE > > < Alt-Svc: quic=":443"; ma=2592000; v="36,35,34,33,32" > > < Accept-Ranges: none > > < Vary: Accept-Encoding > > < Transfer-Encoding: chunked > > < > > { > > "error" : "invalid_request", > > "error_description" : "Required parameter is missing: grant_type" > > * Connection #0 to host webproxy.h.corp.services left intact > > * Closing connection #0 > > } > > > > When I run the test Java code on my workstation I successfully obtain the > required authentication token back from Google. > > > > This is the code snippet that is throwing the exception. > > *HttpResponse httpResponse = httpclient.execute(httppost);* > > > > When this code executes on Linux box I receive the following exception > after 20 seconds. > > org.apache.http.conn.HttpHostConnectException: Connection to > https://accounts.google.com refused > > at > org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:190) > > at > org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:294) > > at > org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:643) > > at > org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:479) > > at > org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906) > > at > org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805) > > at > org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:784) > > at > com.findlaw.adwords.AdWordsApiApplication.run(AdWordsApiApplication.java:87) > > at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70) > > at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:84) > > at > com.findlaw.adwords.AdWordsApiApplication.main(AdWordsApiApplication.java:152) > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > > at java.lang.reflect.Method.invoke(Method.java:497) > > at org.apache.hadoop.util.RunJar.run(RunJar.java:221) > > at org.apache.hadoop.util.RunJar.main(RunJar.java:136) > > Caused by: java.net.ConnectException: Connection timed out > > at java.net.PlainSocketImpl.socketConnect(Native Method) > > at > java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) > > at > java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) > > at > java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) > > at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) > > at java.net.Socket.connect(Socket.java:589) > > at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668) > > at > org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:414) > > at > org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:180) > > ... 16 more > -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ Also find us on our blog and Google+: https://googleadsdeveloper.blogspot.com/ https://plus.google.com/+GoogleAdsDevelopers/posts =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ You received this message because you are subscribed to the Google Groups "AdWords API Forum" group. To post to this group, send email to adwords-api@googlegroups.com To unsubscribe from this group, send email to adwords-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/adwords-api?hl=en --- You received this message because you are subscribed to the Google Groups "AdWords API Forum" group. To unsubscribe from this group and stop receiving emails from it, send an email to adwords-api+unsubscr...@googlegroups.com. Visit this group at https://groups.google.com/group/adwords-api. To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/ad7d9da1-3b2d-4b61-bad4-debc6ce5f620%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.