cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: Asynchronous call with Java first approach
Date Wed, 01 Sep 2010 20:07:56 GMT
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
> pierre-julien.villoud@atosorigin.com<mailto:yann.zimmermann@atosorigin.com>
> 
> 
> 
> 
> ________________________________
> 
> 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
dkulp@apache.org
http://dankulp.com/blog

Mime
View raw message