You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@xml.apache.org by "McEligot, Sean (contractor)" <Mc...@MTMC.ARMY.MIL> on 2002/03/26 23:04:54 UTC

http timeouts

I did not receive a response in soap-user to this message so maybe this is
correct place to post it.

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



Re: http timeouts

Posted by Scott Nichol <sc...@yahoo.com>.
Sean,

I'm not sure why you needed to change Message.java.  Your client code can
create a SOAPHTTPConnection, set its timeout, then set the transport on the
Message (or Call for RPC) instance:

SOAPHTTPConnection st = new SOAPHTTPConnection();
st.setTimeout(xxx);
Message msg = new Message();
msg.setSOAPTransport(st);
...
msg.send(...);

Scott Nichol

----- Original Message -----
From: "McEligot, Sean (contractor)" <Mc...@MTMC.ARMY.MIL>
To: <so...@xml.apache.org>
Sent: Tuesday, March 26, 2002 17:04
Subject: http timeouts


> I did not receive a response in soap-user to this message so maybe this is
> correct place to post it.
>
> 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);
>   }
>
>
>


Re: http timeouts

Posted by Scott Nichol <sc...@yahoo.com>.
Sean,

I'm not sure why you needed to change Message.java.  Your client code can
create a SOAPHTTPConnection, set its timeout, then set the transport on the
Message (or Call for RPC) instance:

SOAPHTTPConnection st = new SOAPHTTPConnection();
st.setTimeout(xxx);
Message msg = new Message();
msg.setSOAPTransport(st);
...
msg.send(...);

Scott Nichol

----- Original Message -----
From: "McEligot, Sean (contractor)" <Mc...@MTMC.ARMY.MIL>
To: <so...@xml.apache.org>
Sent: Tuesday, March 26, 2002 17:04
Subject: http timeouts


> I did not receive a response in soap-user to this message so maybe this is
> correct place to post it.
>
> 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);
>   }
>
>
>