title: How to send multiple asynchronous requests to different web services?
body: <p>I need to send multiple requests to many different web services and receive the results. The problem is that, if I send the requests one by one it takes so long as I need to send and process all individually.</p>
  
  <p>I am wondering how I can send all the requests at once and receive the results.</p>
  
  <p>As the following code shows, I have three major methods and each has its own sub methods.
  Each sub method sends request to its associated web service and receive the results;therefore, for example, to receive the results of web service 9 I have to wait till all web services from 1 to 8 get completed, it takes a long time to send all the requests one by one and receive their results.</p>
  
  <p>As shown below none of the methods nor sub-methods are related to each other, so I can call them all and receive their results in any order, the only thing which is important is to receive the results of each sub-method and populate their associated lists.</p>
  
  <pre><code>private List&lt;StudentsResults&gt; studentsResults = new ArrayList();
  private List&lt;DoctorsResults&gt; doctorsResults = new ArrayList();
  private List&lt;PatientsResults&gt; patientsResults = new ArrayList();
  
  main (){
      retrieveAllLists();
  }
  
  retrieveAllLists(){
  
       retrieveStudents();
       retrieveDoctors();
       retrievePatients();
  }
  
  retrieveStudents(){
  
      this.studentsResults = retrieveStdWS1();   //send request to Web Service 1 to receive its  list of students
      this.studentsResults = retrieveStdWS2();  //send request to Web Service 2 to receive its  list of students
      this.studentsResults = retrieveStdWS3(); //send request to Web Service 3 to receive its  list of students
  
  }
  
  retrieveDoctors(){
  
     this.doctorsResults = retrieveDocWS4();   //send request to Web Service 4 to receive its list of doctors
     this.doctorsResults = retrieveDocWS5();  //send request to Web Service 5 to receive its  list of doctors
     this.doctorsResults = retrieveDocWS6(); //send request to Web Service 6 to receive its  list of doctors
  
  }
  
  retrievePatients(){
  
     this.patientsResults = retrievePtWS7();   //send request to Web Service 7 to receive its list of patients
     this.patientsResults = retrievePtWS8();  //send request to Web Service 8 to receive its list of patients
     this.patientsResults = retrievePtWS9(); //send request to Web Service 9 to receive its list of patients
  
  }
  </code></pre>