0 Replies Latest reply on Feb 9, 2010 5:03 AM by bujo

    Exception handling in asynchronous web service calls

      Hi there!

       

      I have implemented an asynchronous web service call (find code attached) using the callback approach via an AsyncHandler. I have noticed an issue where the remote web service is throwing a SOAPFaultException. The issue is the AsynHandler code I wrote, i.e. the handleResponse method, does not seem to catch the exception. In fact it never receives a response in case of an exception. If the call is successful it enters normally and executes the result handling code.

       

      I found a colleague on the net experiencing exactly the same problem in conjunction with CXF. But I'm using WSConsume.

       

      Did somebody experience that before?

       

      Thanks

       

       

       

      The code looks like this:

       

      ServiceAsyncHandler serviceAsyncHandler = new ServiceAsyncHandler(aSomeObject1, aSomeObject2);

      Future<?> response = thePort.getAnalysisAsync(criteria, serviceAsyncHandler);
       


      Here is the AsyncHandler code :

       

      public void handleResponse(Response<AnalysisResponse> response) {

           try {

                Object object = response.get();

                this.analysis = (Analysis)object;

       

                // Do some processing here on the response
        

           } catch(SOAPFaultException ex) {

                LOGGER.error("ERROR : KATDataServiceAsyncHandler", ex);

           } catch (InterruptedException ex) {

                LOGGER.error("ERROR : KATDataServiceAsyncHandler", ex);

           } catch (ExecutionException ex) {

                LOGGER.error("ERROR : KATDataServiceAsyncHandler", ex);

           }
      }