[jboss-user] [JBossWS] - Problem of getting asynchronous response

zzuli do-not-reply at jboss.com
Wed Mar 11 13:51:03 EDT 2009


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.

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4217102#4217102

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4217102



More information about the jboss-user mailing list