11.07.2015 Views

Anyframe CXF JAX-WS Plugin

Anyframe CXF JAX-WS Plugin

Anyframe CXF JAX-WS Plugin

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Asynchronous Invocationinterface and handleReponse method should be implemented. The following is a part ofMovieAsyncHandler.java which implements AsyncHandler class.public class MovieAsyncHandler implements AsyncHandler {private FindMovieListAllResponse reply;public void handleResponse(Response response) {try {System.err.println("handleResponse called");reply = response.get();} catch (Exception ex) {ex.printStackTrace();}}public List getResponse() {return reply.getReturn();}...• Test caseThe following is an example of accessing Movie Service exposed to Web Services usingjava codes which were created through the above-mentioned codes and tools. ThroughMovieServiceAsynchService, a WebService client code created through tool, asynchronously call themethod of Movie Service interface exposed to Web Services. In this case, access using <strong>WS</strong>DL fileand Service Name. After getting Movie Service, call findMovieListAllAsync() method asynchronous ofMovie Service and test if the calling is working properly.private static final QName SERVICE_NAME =new QName("http://asynch.jaxws.movie.sample.anyframe/asynch_soap_http","MovieServiceAsynchService");/*** Search for the whole movie list in Polling approach* among Asynchronous method invocations.*/File wsdl = new File("src/test/resources/webservices/asynch/wsdl/MovieServiceAsynchService.wsdl");MovieServiceAsynchService client =new MovieServiceAsynchService(wsdl.toURL(), SERVICE_NAME);MovieServiceAsynch movieService = client.getMovieServiceAsynchPort();// 1. find movie list allResponse response =movieService.findMovieListAllAsync();// 2. wait for response after asynchronous method invocationwhile (!response.isDone()) {Thread.sleep(100);}// 3. check the movie list countFindMovieListAllResponse reply = response.get();assertEquals(2, reply.getReturn().size());/*** Search for the whole movie list in Callback approach34

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!