My Google App Engine application use a web service, this web service is pretty slow to respond and sometimes my application crashes :
java.net.SocketTimeoutException: Timeout while fetching URL: http://...
To call this web service, I use classes generated with wsimport (Java tool to parse an existing WSDL file and generate required files).
I need to change the default deadline (5 seconds) either for this call or globally for all my app URL fetches.
App engine docs :
You can set a deadline for a request, the most amount of time the service will wait for a response. By default, the deadline for a fetch is 5 seconds. The maximum deadline is 60 seconds for HTTP requests and 10 minutes for task queue and cron job requests. When using the URLConnection interface, the service uses the connection timeout (setConnectTimeout()) plus the read timeout (setReadTimeout()) as the deadline.
Source : https://developers.google.com/appengine/docs/java/urlfetch/#Java_Making_requests
I tried to add this lines (in strong below) in my code to change the deadline but it did'nt work :
URL urlConnection = new URL(url);
URLConnection connection = urlConnection.openConnection();
connection.setConnectTimeout(180000); // 3 minutes
connection.setReadTimeout(180000); // 3 minutes
SWS webService = new SWS(urlConnection, new QName("http://...", "SWS"));
Note : SWS is the main class generated by wsimport from my WSDL