5 Replies Latest reply on Nov 27, 2007 11:53 AM by ropalka

    asynchronous webservice posible with jboss ?

    jimmymani

      is it possible to make asynchronous call to webservice deployed in jboss?

      since jboss implementing jbossWS other than Axis in jboss-4.0.4.GA.

      can we implement axis2 instead of using jbossWS to support asynchrous?

        • 1. Re: asynchronous webservice posible with jboss ?
          zauberlehrling

          I tried the following:

          package ws
          
          import javax.jws.Oneway;
          import javax.jws.WebMethod;
          import javax.jws.WebService;
          import javax.ejb.Stateless;
          
          
          @WebService
          @Stateless
          public class Hotel {
          
           @Oneway
           @WebMethod
           public void
           reserve(String input) {
           System.out.println("input: "+input);
           for (int i =0; i < 60; i++) {
           try {
           Thread.sleep(1000);
           } catch (InterruptedException e) {
           e.printStackTrace();
           }
           System.out.println("i: "+i);
           }
           }
          }

          According to the JAX-WS User Guide it should be an asynchronous webservice because of the annotation @Oneway. But it's not.
          I've tested this JBoss-4.2.0.GA and jboss-5.0.0.Beta2. The call to
          this webservice is blocking. Any help is appreciated!

          Thanks in adavance for any help,

          Frank


          • 2. Re: asynchronous webservice posible with jboss ?
            jyc5131

            good question, i am finding it now too, any help is appreciated

            • 3. Re: asynchronous webservice posible with jboss ?
              heiko.braun

              Read about the JAX-WS client programming models. There is a difference between asynchronous and one-way invocations:
              http://jbws.dyndns.org/mediawiki/index.php?title=JAX-WS_User_Guide#Web_Service_Clients

              • 4. Re: asynchronous webservice posible with jboss ?

                Hello,

                according to my testing, oneway method does not return the thread of control to the calling application prior to executing the actual business method.

                I have read the spec, but please can somebody know answer these questions?

                1. Is it possible to call oneway method in asynchronous manner?
                2. I know that I can add "Async" suffix to the method and jbossws will call method in asynchronous manner, but I think that it's only simulation of asynchronous behaviour. Connection between client and server is hold until webservice method exists. Or am I wrong? I would like that client calls the webservice method and all connections are immediately closed.

                I use JBossWS-4.2.1.GA and JBossWS-2.0.0.GA

                Thank for reply
                Regards
                Pavel

                • 5. Re: asynchronous webservice posible with jboss ?
                  ropalka

                  Hi Pavel,

                  yes, you're right, oneway call is synchronous. (We're maintaining session HTTP headers when forced by user for example - one of reason). However you can always implement asynchronous oneway invocations. Just wrap you oneway calls to separate thread ;-)

                  Richard