I finally manage to call my web service methods asynchronously with the invoke method of org.apache.cxf.endpoint.Client
Thanks again Pierre-Julien -----Message d'origine----- De : Daniel Kulp [mailto:[email protected]] Envoyé : vendredi 3 septembre 2010 17:02 À : [email protected] Cc : Villoud Pierre Julien Objet : Re: Asynchronous call with Java first approach On Friday 03 September 2010 5:08:19 am Villoud Pierre Julien wrote: > Thanks for your help. Could you indicate me how to use java2ws to generate > the wrappers ? There is a -wrapperbean flag to the java2ws tool that will generate the beans. You would probably need to also add the -s <source-directory> flags to tell it where to generate them to. Dan > I'm successfully using the maven plugin to generate the > wsdl : > > pom.xml---------------------------------------- > > ... > <executions> > <execution> > <id>process-classes</id> > <phase>process-classes</phase> > <configuration> > <className>fr.Hello.ws.MyService</className> > <genWsdl>true</genWsdl> > <verbose>true</verbose> > </configuration> > <goals> > <goal>java2ws</goal> > </goals> > </execution> > </executions> > ... > ----------------------------------------------- > MyServiceImpl.java----------------------------- > > ... > @RequestWrapper(localName = "sendMessageAsync", className = > "fr.Hello.ws.types.sendMessage") @ResponseWrapper(localName = > "sendMessageResponse", className = > "fr.Hello.ws.types.sendMessageResponse") @WebMethod(operationName = > "sendMessageAsync") > public Response<fr.Hello.ws.types.sendMessageResponse> > sendMessageAsync(String message); ... > ----------------------------------------------- > > Thanks in advance > > Best Regards > > Pierre-Julien > > -----Message d'origine----- > De : Daniel Kulp [mailto:[email protected]] > Envoyé : mercredi 1 septembre 2010 22:08 > À : [email protected] > Cc : Villoud Pierre Julien > Objet : Re: Asynchronous call with Java first approach > > On Wednesday 01 September 2010 11:37:56 am Villoud Pierre Julien wrote: > > Hi every one, > > > > I'm using CXF for my Soap Web Service and I would like to enable > > asynchronous calls. I saw in the documentation that it was possible with > > a wsdl first approach. Is it possible with Java first ? What are the > > necessary steps to achieve this ? > > I assume you are talking client side. For the most part, it's just a > matter of putting the correct method signatures onto the SEI and probably > creating the Request/Reponse wrappers (the java2ws tool can create initial > versions of those wrappers). For example, if you have a method like: > > public java.lang.String greetMe( > java.lang.String requestType > ) > > you would need to add methods like: > > @RequestWrapper(localName = "greetMe", > targetNamespace = > "http://cxf.apache.org/greeter_control/types", className = > "org.apache.cxf.greeter_control.types.GreetMe") @ResponseWrapper(localName > = "greetMeResponse", > targetNamespace = > "http://cxf.apache.org/greeter_control/types", className = > "org.apache.cxf.greeter_control.types.GreetMeResponse") > @WebMethod(operationName = "greetMe") > public Response<org.apache.cxf.greeter_control.types.GreetMeResponse> > greetMeAsync( @WebParam(name = "requestType", targetNamespace = > "http://cxf.apache.org/greeter_control/types") java.lang.String > requestType > ); > > @RequestWrapper(localName = "greetMe", > targetNamespace = > "http://cxf.apache.org/greeter_control/types", className = > "org.apache.cxf.greeter_control.types.GreetMe") @ResponseWrapper(localName > = "greetMeResponse", > targetNamespace = > "http://cxf.apache.org/greeter_control/types", className = > "org.apache.cxf.greeter_control.types.GreetMeResponse") > @WebMethod(operationName = "greetMe") > public Future<?> greetMeAsync( > @WebParam(name = "requestType", > targetNamespace = > "http://cxf.apache.org/greeter_control/types") java.lang.String > requestType, > @WebParam(name = "asyncHandler", targetNamespace = "") > AsyncHandler<org.apache.cxf.greeter_control.types.GreetMeResponse> > asyncHandler ); > > The first form is for a more "polling" version where you would poll the > Response object to see if it's done yet. The second is more even driven > where your handler would be called when the response arrives. > > Dan > > > Thanks in advance > > > > Best regards > > > > Pierre-Julien VILLOUD > > Responsable d'Applications > > Unité Public - Santé - Transport - Atos Worldline > > [email protected]<mailto:[email protected] > > m> > > > > > > > > > > ________________________________ > > > > Ce message et les pièces jointes sont confidentiels et réservés à l'usage > > exclusif de ses destinataires. Il peut également être protégé par le > > secret professionnel. Si vous recevez ce message par erreur, merci d'en > > avertir immédiatement l'expéditeur et de le détruire. L'intégrité du > > message ne pouvant être assurée sur Internet, la responsabilité du groupe > > Atos Origin ne pourra être recherchée quant au contenu de ce message. > > Bien que les meilleurs efforts soient faits pour maintenir cette > > transmission exempte de tout virus, l'expéditeur ne donne aucune > > garantie à cet égard et sa responsabilité ne saurait être recherchée > > pour tout dommage résultant d'un virus transmis. > > > > This e-mail and the documents attached are confidential and intended > > solely for the addressee; it may also be privileged. If you receive this > > e-mail in error, please notify the sender immediately and destroy it. As > > its integrity cannot be secured on the Internet, the Atos Origin group > > liability cannot be triggered for the message content. Although the > > sender endeavours to maintain a computer virus-free network, the sender > > does not warrant that this transmission is virus-free and will not be > > liable for any damages resulting from any virus transmitted. > > -- > Daniel Kulp > [email protected] > http://dankulp.com/blog > > > > Ce message et les pièces jointes sont confidentiels et réservés à l'usage > exclusif de ses destinataires. Il peut également être protégé par le > secret professionnel. Si vous recevez ce message par erreur, merci d'en > avertir immédiatement l'expéditeur et de le détruire. L'intégrité du > message ne pouvant être assurée sur Internet, la responsabilité du groupe > Atos Origin ne pourra être recherchée quant au contenu de ce message. Bien > que les meilleurs efforts soient faits pour maintenir cette transmission > exempte de tout virus, l'expéditeur ne donne aucune garantie à cet égard > et sa responsabilité ne saurait être recherchée pour tout dommage > résultant d'un virus transmis. > > This e-mail and the documents attached are confidential and intended solely > for the addressee; it may also be privileged. If you receive this e-mail > in error, please notify the sender immediately and destroy it. As its > integrity cannot be secured on the Internet, the Atos Origin group > liability cannot be triggered for the message content. Although the sender > endeavours to maintain a computer virus-free network, the sender does not > warrant that this transmission is virus-free and will not be liable for > any damages resulting from any virus transmitted. -- Daniel Kulp [email protected] http://dankulp.com/blog Ce message et les pièces jointes sont confidentiels et réservés à l'usage exclusif de ses destinataires. Il peut également être protégé par le secret professionnel. Si vous recevez ce message par erreur, merci d'en avertir immédiatement l'expéditeur et de le détruire. L'intégrité du message ne pouvant être assurée sur Internet, la responsabilité du groupe Atos Origin ne pourra être recherchée quant au contenu de ce message. Bien que les meilleurs efforts soient faits pour maintenir cette transmission exempte de tout virus, l'expéditeur ne donne aucune garantie à cet égard et sa responsabilité ne saurait être recherchée pour tout dommage résultant d'un virus transmis. This e-mail and the documents attached are confidential and intended solely for the addressee; it may also be privileged. If you receive this e-mail in error, please notify the sender immediately and destroy it. As its integrity cannot be secured on the Internet, the Atos Origin group liability cannot be triggered for the message content. Although the sender endeavours to maintain a computer virus-free network, the sender does not warrant that this transmission is virus-free and will not be liable for any damages resulting from any virus transmitted.
