0 Replies Latest reply on Mar 11, 2009 1:51 PM by zwz mycoy

    Problem of getting asynchronous response

    zwz mycoy Newbie

      Hi,everyone:
      I'm getting started with JAX-WS, and get stuck with getting the asynchronous message response.
      The code:

      private void getStudentList(JAXWS ws) throws Exception{
      GetStudentListRequest request= new GetStudentListRequest();
      request.setDepId(1);
      ws.getStuListAsync(request, new GetStudentListCallBack() );
      System.out.println("print immediately after call ws.");

      try {
      Thread.sleep(20000);
      } catch (InterruptedException e) {
      }
      }

      private class GetStudentListCallBack implements javax.xml.ws.AsyncHandler{
      public void handleResponse(Response res) { System.out.println("test1"); try{
      System.out.println("test2");
      System.out.println(res.get());
      }catch (Exception e) {
      }
      }
      }

      When i run the code, i get "test1" and "test2" printed, but there's no result of res.get(), it seems that the "get()" method-call is blocked, but there's no exception.
      If i try "res.isDone()", i can get "true".
      I use jboss5.0.1
      Could anyone help me? Thanks a lot.