that's pretty much how we setup our test case ... looks right, at least.
// Setup parameters for commons-httpclient
HttpClientParams params = new HttpClientParams();
// DO THIS
params.setBooleanParameter(HttpMethodParams.USE_EXPECT_CONTINUE,
false);
params.setVersion(HttpVersion.HTTP_1_1);
// -OR-
// params.setVersion(HttpVersion.HTTP_1_0); // force use of
HTTP/1.0
params.setSoTimeout(50);
// Add custom commons-httpclient parameters to XFire's client
client.setProperty(CommonsHttpMessageSender.HTTP_CLIENT_PARAMS,
params);
This was a few months ago (September), using xfire-1.0, I think - so its
entirely possible that something has changed and this approach no longer
works. To figure this out, I had to do some very painful debugger runs
... hopefully that isn't needed again.
Cheers,
Brice Ruth
-----Original Message-----
From: news [mailto:[EMAIL PROTECTED] On Behalf Of kclarke
Sent: Friday, January 26, 2007 11:13 AM
To: [email protected]
Subject: [xfire-user] Re: getting client-side timeout to work
Brice Ruth <bdruth <at> gmail.com> writes:
> In researching this in the past, I found that there's a "problem" with
just
setting the SoTimeout when the connection uses HTTP/1.1, because of
something
called "Expect: 100-Continue" - apparently this has something to do with
keep-
alive, and it totally hoses timeouts. So, when you're setting up your
HttpClientParams, you need to either disable 100-Continue, or switch to
HTTP/1.0. Either of these should make your timeout work as expected.
> HttpClientParams.USE_EXPECT_CONTINUE
(false)setVersion(HttpVersion.HTTP_1_0)
either of these should do the trick.Cheers,Brice
Thanks for the suggestion. I gave that a try (w/both), and still the
connection manager returns a connection with timeout set to 0/disabled.
Not
sure if my changes to httpClientParams are actually being seen where
they
should be. Here's the whole line of code:
Service serviceModel = new ObjectServiceFactory().create
(TesterWebService.class);
TesterWebService testerService = (TesterWebService) new
XFireProxyFactory
().create(serviceModel, args[0]);
Client client = Client.getInstance(testerService);
...
int timeoutMs = client.getTimeout();
client.setProperty(CommonsHttpMessageSender.HTTP_TIMEOUT,
Integer.toString
((timeoutMs/1000)));
HttpClientParams httpClientParams = new HttpClientParams();
httpClientParams.setConnectionManagerTimeout(timeoutMs);
httpClientParams.setSoTimeout(timeoutMs);
httpClientParams.setBooleanParameter(HttpClientParams.USE_EXPECT_CONTINU
E,
false);
httpClientParams.setVersion(HttpVersion.HTTP_1_0);
client.setProperty(CommonsHttpMessageSender.HTTP_CLIENT_PARAMS,
httpClientParams);
logger.debug("doSleep: " + testerService.doSleep(timeoutMs *2));
logging still shows:
3219 [main] DEBUG
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager:getConn
ectionW
ithTimeout:390 - HttpConnectionManager.getConnection: config =
HostConfiguration[host=http://xxx.xxx.xxx.xxx:7003], timeout = 0
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email