users@saaj.java.net

Re: [SAAJ-USR] Q: Setting HTTP client socket timeouts for SAAJ client?

From: Andreas Loew <Andreas.Loew_at_Sun.COM>
Date: Tue, 05 Jun 2007 11:47:35 +0200

Kumar,

V B Kumar Jayanti schrieb:
> Hi Andreas,
>
> SAAJ Allows you to Override the SOAPConnectionFactory via
> META-INF/services.
>
> Just change the META-INF/services entry named
> "javax.xml.soap.SOAPConnectionFactory" to contain the fully qualified
> package name of your Extended Implementation.
>
> If you want a support for these properties in SAAJ RI then please
> file an RFE (P4).

I'll consider filing an RFE, but mainly, I still need a short-term
solution (i.e. using a "workaround" is fine).

I don't know whether overriding the SOAPConnectionFactory will do the trick:

I think the starting point is line 718ff. of HttpSOAPConnection.java
which reads

718 private java.net.HttpURLConnection createConnection(URL
endpoint)
719 throws IOException {
720 return (HttpURLConnection) endpoint.openConnection();
721 }

Here, even in its unchanged form, URL#openConnection() in line 720
should (at least, to my knowledge), detect that already I overrode the
target URL's URLStreamHandlerFactory *before* by calling

webserviceURL.setURLStreamHandlerFactory(new
HttpTimeoutHandlerFactory(connectTimeout, readTimeout));

on the exact same URL instance which is passed as "endpoint" into the
ScreateConnection() method:

SOAPConnection conn =
SOAPConnectionFactory.newInstance().createConnection();
SOAPMessage response = conn.call(message, webserviceURL);

Still, it does *NOT* seem to work...!?

Any additional ideas/thoughts on this?

Thanks again & best regards,

Andreas

-- 
Andreas Loew
Java Architect
Sun Microsystems (Germany)