sockettimeoutexception在Google App引擎(JAVA)上令人沮丧。需要解决方法 [英] The sockettimeoutexception is frustrating on Google App engine(JAVA). Workaround needed

查看:141
本文介绍了sockettimeoutexception在Google App引擎(JAVA)上令人沮丧。需要解决方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在连接到以下wsdl
上的第三方服务器: http: //webservices.ticketvala.com/axis2/services/WSTicketvala?wsdl



我使用JAX-WS生成客户端代码并在3日调用相关方法派对服务器。第三方服务器可能需要15到25秒的时间才能发送响应。
它在tomcat上正常工作。



现在,当我将它部署到GAE 1.5.3时,我经常在不到10秒的时间内收到ScocketTimeoutException。有时甚至需要20秒才能成功。我想知道它为什么失败了很多次。和任何解决方法,以增加此响应截止时间/以避免此ScoketTimeOutException永远。



同样,

我有在 http://ticketgoose.com/bookbustickets/TGWSStationNameResponseAction.do 上提供的另一个RESTfull服务?+
event = getStationDetails& password = 123456& userId = ctshubws



我通过java.net.URL连接它,并且很多次我得到TimeoutException。如何将超时限制提高到30秒以上?



感谢
Deepak

解决方案

在Google App Engine中,用户发起的请求不能超过30秒钟完成:
http://code.google.com/intl/zh-CN/appengine/docs/java/runtime.html#The_Request_Timer



在用户发起的请求中,对外部URL的HTTP请求完成时间不超过10秒钟:
http://code.google.com/intl/zh-CN/appengine/docs/java/ urlfetch / overview.html#请求





如果您需要完成整体工作超过30秒,并且可以在后台执行(不需要直接通过HTTP返回响应),请使用任务队列。请注意,使用任务执行后台工作的最简单方法是使用 DeferredTask 。最好的部分是:对任务的外部URL的HTTP请求可能会占用 10分钟完成


I am connecting to a 3rd party server on the following wsdl http://webservices.ticketvala.com/axis2/services/WSTicketvala?wsdl

I am using JAX-WS to generate client code and call relevent method on 3rd party server. 3rd party server may take time between 15-25 seconds to send response. It works fine on tomcat.

Now when i deploy this to GAE 1.5.3, often i get ScocketTimeoutException in less than 10 seconds. Sometimes it is succesfull taking even 20 seconds. I want to know why it fails many times. And any workaround to increase this response deadline time / to avoid this ScoketTimeOutException forever.

Similarly,

I have another RESTfull service at http://ticketgoose.com/bookbustickets/TGWSStationNameResponseAction.do?" + "event=getStationDetails&password=123456&userId=ctshubws

I am connecting it through java.net.URL and many times i get TimeoutException. How can i raise this timeout limit to more than 30 seconds?

Thanks Deepak

解决方案

No user-initiated request can take more than 30 seconds to complete in Google App Engine: http://code.google.com/intl/en/appengine/docs/java/runtime.html#The_Request_Timer

And a HTTP request to a external URL in a user-initiated request can't take more than 10 seconds to complete: http://code.google.com/intl/en/appengine/docs/java/urlfetch/overview.html#Requests

If you need to do the overall work in more than 30 seconds and can do it in background (not needing to return the response directly via HTTP), use Task Queues. Note that the simplest way to do background work with tasks is to use the DeferredTask. And the best part: HTTP requests to external URLs on tasks can take up to 10 minutes to complete.

这篇关于sockettimeoutexception在Google App引擎(JAVA)上令人沮丧。需要解决方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆