The same thing could be done to Call.invoke(), adding something like:
if (st instanceof SOAPHTTPConnection) {
        SOAPHTTPConnection http = (SOAPHTTPConnection)st;
        http.setTimeout(timeoutMillis);
}

> My application needs to be able to detect and handled network 
> failures. For
> this I needed timeouts. There was already support for timeouts in
> SOAPHTTPConnection, but I could not find an inteface to this, 
> so I added my
> own. I added this send method to my local copy of 
> Message.java from SOAP
> 2.2. It has been working fine for me for a few weeks now. I 
> want to know if
> now if there is another way to do this. If not, should this method or
> something similar be added to apache SOAP?
> 
> Sean McEligot
> 
>   /**
>    * Send an envelope to the given URL via the SOAPTransport that has
>    * been configured for this instance (or SOAPHTTPConnection 
> by default).
>    * The envelope is sent exactly as-is.
>    * 
>    * @param url the url to send to
>    * @param actionURI the value of the SOAPAction header
>    * @param env envelope to send
>        * @param timeoutMillis the amount of time, in ms, to block on
> reading data.
>    *                A zero value indicates an infinite timeout.
>    *
>    * @exception SOAPException if something goes wrong.
>    */
>   public void send (URL url, String actionURI, Envelope env, int
> timeoutMillis)
>        throws SOAPException {
>     // Construct default HTTP transport if not specified.
>     if (st == null) {
>       st = new SOAPHTTPConnection ();
>       if (st instanceof SOAPHTTPConnection) {
>       ((SOAPHTTPConnection)st).setTimeout(timeoutMillis);
>       }
>     }
> 
>     // Send request.
>     st.send (url, actionURI, null, env, null, reqCtx);
>   }
> 
> 

Reply via email to