how to set timeout(java ads-lib 1.8)

354 views
Skip to first unread message

aminotsukasa

unread,
Sep 11, 2012, 4:04:01 AM9/11/12
to adwor...@googlegroups.com
Hi all

Now I'm writing a program with new adwords library.
I will use this program with slow network(3G/WLAN....)
Because I want to set timeout second to Service class.
But I can't find out setTimeout method.

> service = adWordsServices.get(session, TargetingIdeaServiceInterface.class);
> service.setTimeout(xxx); // No such method!

With old library(adwords-lib 8) I can set timeout second .
> ((org.apache.axis.client.Stub) service).setTimeout(timeout);

Does anyone know the issue?
How many default timeout second?

Kevin Winter

unread,
Sep 13, 2012, 10:04:47 AM9/13/12
to adwor...@googlegroups.com
Hi,
  One of my colleagues helped me with this.  You can still set the timeout, but its a bit hackier than with the old lib.  Here's the code i was able to add the the GetCampaigns example:

    AdWordsServiceClient handler = (AdWordsServiceClient)Proxy.getInvocationHandler(campaignService);
    ((Stub)handler.getSoapClient()).setTimeout(20*1000);

I verified that this works by setting it to 20 initially (it's in milliseconds) and I ended up with: java.net.SocketTimeoutException: Read timed out

We're investigating the best way to surface this and other similar options in a future release.

- Kevin Winter
AdWords API Team
Reply all
Reply to author
Forward
0 new messages