You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by "McEligot, Sean (contractor)" <Mc...@MTMC.ARMY.MIL> on 2002/03/15 17:39:59 UTC

http Timeouts

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);
  }