Nop. The SEI is the one that I have sent to you. The only difference is that I 
have added the polling method (I have put return null in its implementation). 
The other "strange" thing is that when I call the async method the environment 
first call the Myping synchronous method...

Enviado do meu iPhone

No dia 07/01/2015, às 18:41, André Costa Lima [via CXF] 
<[email protected]> escreveu:

> Are you referencing 
> pt.uninova.proseco.services.jaxws_asm.MypingWebServiceResponse anywhere in 
> your SEI? 
> 
> André Costa Lima 
> 
> 
> 2015-01-07 15:46 GMT+00:00 gido <[hidden email]>: 
> 
> > Dear André, 
> > 
> > 
> > 
> > I have added the polling method and it starts to work, or better the error 
> > is different. Now I have the following excpetion: 
> > 
> > 
> > 
> > Jan 07, 2015 3:27:26 PM pt.uninova.proseco.services.async.TestAsyncHandler 
> > handleResponse 
> > 
> > SEVERE: null 
> > 
> > java.util.concurrent.ExecutionException: java.lang.ClassCastException: 
> > pt.uninova.proseco.services.jaxws_asm.MypingWebServiceResponse cannot be 
> > cast to pt.uninova.proseco.services.async.response.MypingMessage 
> > 
> >                 at 
> > org.apache.cxf.jaxws.JaxwsClientCallback$2.get(JaxwsClientCallback.java:99) 
> > 
> >                 at 
> > pt.uninova.proseco.services.async.TestAsyncHandler.handleResponse(TestAsyncHandler.java:27)
> >  
> > 
> >                 at 
> > org.apache.cxf.jaxws.JaxwsClientCallback.handleException(JaxwsClientCallback.java:87)
> >  
> > 
> >                 at 
> > org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:821) 
> > 
> >                 at 
> > org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1636)
> >  
> > 
> >                 at 
> > org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream$1.run(HTTPConduit.java:1145)
> >  
> > 
> >                 at 
> > org.apache.cxf.workqueue.AutomaticWorkQueueImpl$3.run(AutomaticWorkQueueImpl.java:428)
> >  
> > 
> >                 at 
> > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
> > 
> >                 at 
> > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> >  
> > 
> >                 at 
> > org.apache.cxf.workqueue.AutomaticWorkQueueImpl$AWQThreadFactory$1.run(AutomaticWorkQueueImpl.java:353)
> >  
> > 
> >                 at java.lang.Thread.run(Thread.java:744) 
> > 
> > Caused by: java.lang.ClassCastException: 
> > pt.uninova.proseco.services.jaxws_asm.MypingWebServiceResponse cannot be 
> > cast to pt.uninova.proseco.services.async.response.MypingMessage 
> > 
> >                 at 
> > pt.uninova.proseco.services.async.TestAsyncHandler.handleResponse(TestAsyncHandler.java:27)
> >  
> > 
> >                 at 
> > org.apache.cxf.jaxws.JaxwsClientCallback.handleResponse(JaxwsClientCallback.java:44)
> >  
> > 
> >                 at 
> > org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:819) 
> > 
> >                 ... 7 more 
> > 
> > 
> > 
> > Exception in thread "main" java.lang.NullPointerException 
> > 
> >                 at 
> > pt.uninova.proseco.services.async.TestAsyncHandler.getResponse(TestAsyncHandler.java:34)
> >  
> > 
> >                 at 
> > pt.uninova.proseco.async.AsyncTestMainClass.main(AsyncTestMainClass.java:51)
> >  
> > 
> > 
> > 
> > Basically I have a cast exception here: 
> > 
> > 
> > 
> > public class TestAsyncHandler implements AsyncHandler<MypingResponse> { 
> > 
> > 
> > 
> >     private MypingResponse reply; 
> > 
> > 
> > 
> >     @Override 
> > 
> >     public void handleResponse(Response<MypingResponse> rspns) { 
> > 
> >         try { 
> > 
> >             System.err.println("handleResponse called"); 
> > 
> >             reply = rspns.get(); 
> > 
> >         } catch (InterruptedException | ExecutionException ex) { 
> > 
> > 
> > Logger.getLogger(TestAsyncHandler.class.getName()).log(Level.SEVERE, null, 
> > ex); 
> > 
> >         } 
> > 
> >     } 
> > 
> > 
> > 
> >     public String getResponse() { 
> > 
> >         return reply.getTestValue(); 
> > 
> >     } 
> > 
> > 
> > 
> > } 
> > 
> > 
> > 
> > Any suggestion? 
> > 
> > 
> > 
> > BR, 
> > 
> > 
> > 
> > Giovanni 
> > 
> > 
> > 
> > De: André Costa Lima [via CXF] [mailto: 
> > [hidden email]] 
> > Enviada: 7 de janeiro de 2015 13:46 
> > Para: gido 
> > Assunto: Re: Async Calls 
> > 
> > 
> > 
> > I think your class is malformed, i.e., there are missing annotations. 
> > 
> > Take some time to read this 
> > < 
> > http://cxf.apache.org/docs/developing-a-service.html#DevelopingaService-JavaFirstDevelopment
> > >. 
> > The documentation shows and explains how to use the annotations and what 
> > they do. 
> > 
> > As for the asynchronous methods, in addition to the callback method 
> > 
> > public Future<?> MypingAsync(String par, AsyncHandler<MypingResponse> 
> > asyncHandler); 
> > 
> > you need to define the polling method 
> > 
> > public Response<MypingResponse> MypingAsync(String par); 
> > 
> > in your SEI as well. However, you do not need to implement it because it 
> > will never be called but the client can use it. You can read more about the 
> > asynchronous invocation model here 
> > < 
> > http://cxf.apache.org/docs/developing-a-consumer.html#DevelopingaConsumer-AsynchronousInvocationModel
> > > 
> > . 
> > 
> > On a different note, I do now know how CXF handles interface extension for 
> > SEIs, such as you define below 
> > 
> > public interface IAmIMonitoringService extends IProsecoService 
> > 
> > Maybe a developer can answer that. 
> > 
> > Hope this helps. :) 
> > 
> > André Costa Lima 
> > 
> > 
> > 2015-01-07 10:52 GMT+00:00 gido <[hidden email]>: 
> > 
> > 
> > > Hi André, 
> > > 
> > > 
> > > 
> > > Here you can find the SEI and its implementation: 
> > > 
> > > 
> > > 
> > > @WebService 
> > > 
> > > @SOAPBinding(style = SOAPBinding.Style.DOCUMENT) 
> > > 
> > > public interface IProsecoService { 
> > > 
> > > 
> > > 
> > >     @WebMethod(operationName = "startWebService") 
> > > 
> > >     public void start(); 
> > > 
> > > 
> > > 
> > >     @WebMethod(operationName = "stopWebService") 
> > > 
> > >     public void stop(); 
> > > 
> > > 
> > > 
> > >     @WebMethod(operationName = "restartWebService") 
> > > 
> > >     public void restart(); 
> > > 
> > > 
> > > 
> > >     @WebMethod(operationName = "pingWebService") 
> > > 
> > >     public String ping(); 
> > > 
> > > 
> > > 
> > >     @WebMethod(operationName = "invokeWebService") 
> > > 
> > >     public boolean configure(String Configuration); 
> > > 
> > > 
> > > 
> > > } 
> > > 
> > > 
> > > 
> > > @WebService(name = "AmIMonitoringService", targetNamespace = " 
> > > http://proseco-project.eu/";) 
> > > 
> > > @SOAPBinding(style = SOAPBinding.Style.DOCUMENT) 
> > > 
> > > public interface IAmIMonitoringService extends IProsecoService { 
> > > 
> > > 
> > > 
> > >     @WebMethod(operationName = "MypingWebService") 
> > > 
> > >     public String Myping(String par); 
> > > 
> > > 
> > > 
> > >     @WebMethod(operationName = "MypingWebService") 
> > > 
> > >     @ResponseWrapper(localName = "MypingResponse", className = 
> > > "pt.uninova.proseco.services.async.response.MypingResponse") 
> > > 
> > >     public Future<?> MypingAsync(String par, AsyncHandler<MypingResponse> 
> > > asyncHandler); 
> > > 
> > > 
> > > 
> > > } 
> > > 
> > > 
> > > 
> > > public class AmIMonitoringService implements IAmIMonitoringService { 
> > > 
> > > 
> > > 
> > >     private static final Logger logger = 
> > > LoggerFactory.getLogger(AmIMonitoringService.class); 
> > > 
> > > 
> > > 
> > >     @Override 
> > > 
> > >     public void start() throws ProsecoFault { 
> > > 
> > >         logger.info(String.format("Starting %s ...", 
> > > this.getClass().getSimpleName())); 
> > > 
> > >     } 
> > > 
> > > 
> > > 
> > >     @Override 
> > > 
> > >     public void stop() throws ProsecoFault { 
> > > 
> > >         logger.info(String.format("Stopping %s ...", 
> > > this.getClass().getSimpleName())); 
> > > 
> > >     } 
> > > 
> > > 
> > > 
> > >     @Override 
> > > 
> > >     public void restart() throws ProsecoFault { 
> > > 
> > >         logger.info(String.format("Restarting %s ...", 
> > > this.getClass().getSimpleName())); 
> > > 
> > >     } 
> > > 
> > > 
> > > 
> > >     @Override 
> > > 
> > >     public String ping() throws ProsecoFault { 
> > > 
> > >         logger.info(String.format("%s was pinged", 
> > > this.getClass().getSimpleName())); 
> > > 
> > >                                return ServiceManager.PING_RESPONSE; 
> > > 
> > >     } 
> > > 
> > > 
> > > 
> > >     @Override 
> > > 
> > >     public boolean configure(String Configuration) throws ProsecoFault { 
> > > 
> > >         throw new UnsupportedOperationException("Not supported yet."); 
> > > //To change body of generated methods, choose Tools | Templates. 
> > > 
> > >     } 
> > > 
> > > 
> > > 
> > >     @Override 
> > > 
> > >     public Future<?> MypingAsync(final String par, final 
> > > AsyncHandler<MypingResponse> asyncHandler) { 
> > > 
> > >         System.out.println("Executing operation changeStudentAsync 
> > > asynchronously\n"); 
> > > 
> > >         final ServerAsyncResponse<MypingResponse> asyncResponse = new 
> > > ServerAsyncResponse<MypingResponse>(); 
> > > 
> > >         new Thread() { 
> > > 
> > >             @Override 
> > > 
> > >             public void run() { 
> > > 
> > >                 try { 
> > > 
> > >                     Thread.sleep(10000); 
> > > 
> > >                 } catch (InterruptedException e) { 
> > > 
> > >                 } 
> > > 
> > >                 MypingResponse resp = new MypingResponse(); 
> > > 
> > >                 resp.setTestValue("Ola " + par); 
> > > 
> > >                 asyncResponse.set(resp); 
> > > 
> > >                 System.out.println("Responding on background thread\n"); 
> > > 
> > >                 asyncHandler.handleResponse(asyncResponse); 
> > > 
> > >             } 
> > > 
> > >         }.start(); 
> > > 
> > > 
> > > 
> > >         return asyncResponse; 
> > > 
> > >     } 
> > > 
> > > 
> > > 
> > >     @Override 
> > > 
> > >     public String Myping(String par) { 
> > > 
> > >         throw new UnsupportedOperationException("Not supported yet."); 
> > > //To change body of generated methods, choose Tools | Templates. 
> > > 
> > >     } 
> > > 
> > > 
> > > 
> > > } 
> > > 
> > > 
> > > 
> > > -          Client code: 
> > > 
> > > IAmIMonitoringService client = ServiceManager.getWebservice("localhost", 
> > > Integer.parseInt("19004"), IAmIMonitoringService.class); 
> > > 
> > >         String pong = client.ping(); 
> > > 
> > >         TestAsyncHandler handler = new TestAsyncHandler(); 
> > > 
> > >         Future<?> response = client.MypingAsync("Giovanni", handler); 
> > > 
> > >          while (!response.isDone()) { 
> > > 
> > >             Thread.sleep(100); 
> > > 
> > >         } 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > public class TestAsyncHandler implements AsyncHandler<MypingResponse> { 
> > > 
> > > 
> > > 
> > >     private MypingResponse reply; 
> > > 
> > > 
> > > 
> > >     @Override 
> > > 
> > >     public void handleResponse(Response<MypingResponse> rspns) { 
> > > 
> > >         try { 
> > > 
> > >             System.err.println("handleResponse called"); 
> > > 
> > >             reply = rspns.get(); 
> > > 
> > >         } catch (InterruptedException | ExecutionException ex) { 
> > > 
> > > 
> > > Logger.getLogger(TestAsyncHandler.class.getName()).log(Level.SEVERE, 
> > null, 
> > > ex); 
> > > 
> > >         } 
> > > 
> > >     } 
> > > 
> > > 
> > > 
> > >     public String getResponse() { 
> > > 
> > >         return reply.getTestValue(); 
> > > 
> > >     } 
> > > 
> > > 
> > > 
> > > } 
> > > 
> > > 
> > > 
> > > I hope this can help. 
> > > 
> > > 
> > > 
> > > BR, 
> > > 
> > > 
> > > 
> > > Giovanni 
> > > 
> > > 
> > > 
> > > De: André Costa Lima [via CXF] [mailto: 
> > > [hidden email]] 
> > > Enviada: 7 de janeiro de 2015 00:30 
> > > Para: gido 
> > > Assunto: Re: Async Calls 
> > > 
> > > 
> > > 
> > > Hi, 
> > > 
> > > Can you provide the code of your SEI class? 
> > > 
> > > Thanks. 
> > > 
> > > André Costa Lima 
> > > 
> > > 
> > > 2015-01-06 23:41 GMT+00:00 gido <[hidden email]>: 
> > > 
> > > 
> > > > Dear all, 
> > > > 
> > > > I have a little problem with the async communication. In particular I 
> > am 
> > > > trying to implement async calls. My idea is to provide a synchronous 
> > > method 
> > > > as well as its async implementation. In such a way I can decide which 
> > > > method 
> > > > is suitable for me according to the specific application context. To do 
> > > > that, I have followed the Apache CXF documentation and the tutorials: 
> > > > 
> > > > 
> > http://www.javatips.net/blog/2014/03/asynchronous-web-service-using-cxf
> > > > http://www.javatips.net/blog/2014/03/cxf-asynchronous-client
> > > > 
> > > > However when I try to call the async method I always receive the 
> > > following 
> > > > exception: 
> > > > 
> > > > Exception in thread "main" javax.xml.ws.WebServiceException: Could not 
> > > find 
> > > > wsdl:binding operation info for web method testAsync. 
> > > >         at 
> > > > org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:126) 
> > > >         at com.sun.proxy.$Proxy62.testAsync(Unknown Source) 
> > > >         at 
> > > > 
> > > > 
> > > 
> > pt.uninova.proseco.async.AsyncTestMainClass.main(AsyncTestMainClass.java:46)
> >  
> > > > 
> > > > If I try to call the synch implmentation I have no problem. 
> > > > 
> > > > I have checked the generated wsdl (I am using the Java first approach) 
> > > and 
> > > > I 
> > > > see that no async operation is included. 
> > > > 
> > > > Do you have any sugestion? 
> > > > 
> > > > BR 
> > > > 
> > > > Giovanni 
> > > > 
> > > > 
> > > > 
> > > > -- 
> > > > View this message in context: 
> > > > http://cxf.547215.n5.nabble.com/Async-Calls-tp5752830.html
> > > > Sent from the cxf-user mailing list archive at Nabble.com. 
> > > > 
> > > 
> > > 
> > > 
> > >   _____ 
> > > 
> > > If you reply to this email, your message will be added to the discussion 
> > > below: 
> > > 
> > > http://cxf.547215.n5.nabble.com/Async-Calls-tp5752830p5752832.html
> > > 
> > > To unsubscribe from Async Calls, click here < 
> > > 
> > > . 
> > >  < 
> > > 
> > http://cxf.547215.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer
> > < 
> > http://cxf.547215.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
> >  
> > &id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
> >  
> > > NAML 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > -- 
> > > View this message in context: 
> > > http://cxf.547215.n5.nabble.com/Async-Calls-tp5752830p5752839.html
> > > Sent from the cxf-user mailing list archive at Nabble.com. 
> > > 
> > 
> > 
> > 
> >   _____ 
> > 
> > If you reply to this email, your message will be added to the discussion 
> > below: 
> > 
> > http://cxf.547215.n5.nabble.com/Async-Calls-tp5752830p5752842.html
> > 
> > To unsubscribe from Async Calls, click here < 
> > 
> > . 
> >  < 
> > http://cxf.547215.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
> >  
> > NAML 
> > 
> > 
> > 
> > 
> > 
> > -- 
> > View this message in context: 
> > http://cxf.547215.n5.nabble.com/Async-Calls-tp5752830p5752847.html
> > Sent from the cxf-user mailing list archive at Nabble.com. 
> > 
> 
> 
> If you reply to this email, your message will be added to the discussion 
> below:
> http://cxf.547215.n5.nabble.com/Async-Calls-tp5752830p5752853.html
> To unsubscribe from Async Calls, click here.
> NAML




--
View this message in context: 
http://cxf.547215.n5.nabble.com/Async-Calls-tp5752830p5752854.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to