Adobe Flex 4.6 WebService request timeout

徘徊边缘 提交于 2019-12-25 02:34:15

问题


The code to get connected to my WebService (Lotus Notes Database) is created by the Flash Builder over "Data/Connect with WebService...". All works fine, but I have a problem to increase the request timeout. The API says that you can set the request timeout like this:

_serviceControl.requestTimeout = 300;

On a iOS (iPad) it seems to be work all fine. But if I run my app on desktop or on an android smartphone this only works if I set up the request timeout lower than ~30 seconds. If I don't set up the request timeout or higher than 30 and my app needs longer than 30 seconds to wait for an answer/result the "_serviceControl" fires an FaultEvent with the message:

body = ""  
clientId = "DirectHTTPChannel0"  
correlationId = "CDED773E-34E5-56F8-D521-4FFC393D7565"  
destination = ""  
extendedData = (null)  
faultCode = "Server.Error.Request"  
faultDetail = "Error: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: "http://...?OpenWebService" errorID=2032]. URL: "http://...?OpenWebService"  
faultString = "HTTP request error"  
headers = (Object)#1  
DSStatusCode = 0  
messageId = "91D11378-49D4-EDF7-CE7A-4FFCB09EBC47"  
rootCause = (flash.events::IOErrorEvent)#2  
bubbles = false  
cancelable = false  
currentTarget = (flash.net::URLLoader)#3  
bytesLoaded = 0  
bytesTotal = 0  
data = ""  
dataFormat = "text"  
errorID = 2032  
eventPhase = 2  
target = (flash.net::URLLoader)#3  
text = "Error #2032: Stream Error. URL: "http://...?OpenWebService"  
type = "ioError"  
timestamp = 0  
timeToLive = 0

Any idea why this happens?


回答1:


I had the same problem, requestTimeout didn't work.

If someone is looking for an answer, this configuration works fine for me :

import flash.net.URLRequestDefaults;

URLRequestDefaults.idleTimeout = 120000; //note this value represents milliseconds (120 secs)

Have a look here for more details : Flex HTTPService times out anyway




回答2:


Though it seems to be assumed that requestTimeout doesn't work. It actually does... the 1st time.

After the 1st request, the requestTimeout is set in

HTTPService.channelSet.currentChannel.requestTimeout

If you have to change the timeout, you will want to do it there.

To see the specific offending code, see AbstractOperation.getDirectChannelSet(). Even for different instances of HTTPService, it pulls from:

private static var _directChannelSet:ChannelSet;

_directChannelSet is only instantiated once, and the requestTimeout on it is only set on creation, so even if you change the requestTimeout on HTTPService, it won't reflect in the request.



来源:https://stackoverflow.com/questions/10598860/adobe-flex-4-6-webservice-request-timeout

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!