title: How do I enforce a timeout on a webservice call using ksoap 2?
body: <p>I need to add a timeout to a J2ME application that uses ksoap 2 to connect to a web service.</p>
  
  <p>I've tried the method described as a possible pseudo timeout at <a href="http://ksoap2.sourceforge.net/doc/api/org/ksoap2/transport/HttpTransport.html" rel="nofollow noreferrer">http://ksoap2.sourceforge.net/doc/api/org/ksoap2/transport/HttpTransport.html</a>, but it doesn't seem to function on this device.</p>
  
  <p>I'd run the connection on another thread and kill it if a timer fires but there's no way to kill a thread before it finishes executing in J2ME per <a href="http://developers.sun.com/mobility/midp/articles/threading2/" rel="nofollow noreferrer">http://developers.sun.com/mobility/midp/articles/threading2/</a> (this is an embedded device, so I can't just leave an indefinite number of threads blocking in the background). I can't use the poll a boolean method since it's the single attempt to open the connection that blocks.</p>
  
  <p>The system timeout seems to vary between device modal and is too long for my purposes.</p>
  
  <p>Does anybody have any thoughts as to something that might work?</p>