about sitemap home home
Databases Data Formats Database Search Genome Browser RNA Secondary Structure Alignments Primer Design WebServices
Technology Simple Client Asynchronity
Exercise Asynchronity
Bielefeld University Center of Biotechnoloy Institute of Bioinformatics BiBiServ
exercise.png 57x15  
Asynchronity
A WebService contains two sides: Client and server. In general a WebService is a synchronous data exchange service of two points connected via a network. This means after a short time (less than the http timeout, which normally is 300 seconds) an answer of the WebService server is required. Bioinformatic programs run usually much longer than five minutes. To avoid problems with timeouts, one could use a technique called Request and reply with polling.
   
 
 
The client side submits a job with the required data (program parameters and data etc.) and immediately gets an id after the job was started which normally takes some seconds (name convention request). Afterwards the client side is able to ask for the result using this id. If the computation of the program is not finished, the client side gets back a statuscode with an enhanced description.
 
 
These statuscodes and their descriptions are defined by HOBIT to reach interoperability between WebServices, which use these statuscodes. They will be represented within the detail part of a SOAP Fault Message according to a HOBIT specified XML Schema called hobitStatuscode. This can easily be evaluated.
This polling technique completely avoids problems with timeouts. The client side can even request the results hours or days later or from another host, just with knowledge of the id.
   
So, a program that implements Request and reply with polling may look like this:
id = webservice.request(input-data) #submit and get an id.
while (true) { #poll until result
  result = webservice.response(id) #poll
  if (!result) { #if NOT finished
   eval_statuscode # check for current status
  } else { #if ready
	break #ready !
  }
  wait 5 #wait short time 
}
process(result)