0 Replies Latest reply on Jun 17, 2009 1:10 PM by kyle.bober

    JBoss 4.2.1 and Apache CXF 2.2.2 Client Code and AsyncHandle

    kyle.bober

      I have implemented an Asynchronous web service call using the Call back
      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 does not seem to catch the exception. In fact it never receives a
      response at all. I am using Apache CXF 2.1.2 to generate the client side
      code

      How do I handle this accordingly???

      Here is the code making the Asynchronous request ::

      // Asynchronous WS callback approach
      ServiceAsyncHandler serviceAsyncHandler = new
      ServiceAsyncHandler(aSomeObject1, aSomeObject2);
      Future<?> response = thePort.getAnalysisAsync(criteria,
      serviceAsyncHandler);

      Here is the AsyncHandler code ::

      /**
      * Aysynchronous KATDataService Handler
      */
      public void handleResponse(Response 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);
      }
      }
      }

      It also seems if I place a snippet of code after I make the Asynchronous
      web service request like so ::

      try {
      response.isDone()
      } catch(SOAPFaultException ex) {
      LOGGER.error("ERROR : Calling Remote Web Service", ex);
      }

      It will catch the SOAPFaultExcpetion occasionally but not all the time so
      this is not 100% reliable. I still have an issue where the
      SOAPFaultExcpetion falls through the cracks and is not caught by either the
      AsynchHandler or the code making the Asynchronous web service call.

      Please can someone explain why this is and how I go about resolving this
      issue.

      -Kyle

      13:03:04,062 ERROR [CommonClient] Exception caught while (preparing for) performing the invocation:
      javax.xml.ws.soap.SOAPFaultException: System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> TSAKeywordAnalysisServices.katAnalysisException: KAT Data Service Exception: ---> System.Exception: Target Page URL did not have any data.
      at clsDataService.getKATAnalysis(KATAnalysisCriteria request) in c:\Hudson\jobs\KAT Data Service\workspace\main\App_Code\clsDataService.cs:line 70
      at KATDataService10.getKATAnalysis(KATAnalysisCriteria request) in c:\Hudson\jobs\KAT Data Service\workspace\main\App_Code\KATDataService1.0.cs:line 27
      --- End of inner exception stack trace ---
      at KATDataService10.getKATAnalysis(KATAnalysisCriteria request) in c:\Hudson\jobs\KAT Data Service\workspace\main\App_Code\KATDataService1.0.cs:line 32
      --- End of inner exception stack trace ---
      at org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS.getSOAPFaultException(SOAPFaultHelperJAXWS.java:84)
      at org.jboss.ws.core.jaxws.binding.SOAP11BindingJAXWS.throwFaultException(SOAP11BindingJAXWS.java:107)
      at org.jboss.ws.core.CommonSOAPBinding.unbindResponseMessage(CommonSOAPBinding.java:579)
      at org.jboss.ws.core.CommonClient.invoke(CommonClient.java:381)
      at org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:290)
      at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:170)
      at org.jboss.ws.core.jaxws.client.ClientProxy.access$000(ClientProxy.java:60)
      at org.jboss.ws.core.jaxws.client.ClientProxy$AsyncRunnable.run(ClientProxy.java:260)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
      at java.util.concurrent.FutureTask.run(FutureTask.java:123)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
      at java.lang.Thread.run(Thread.java:595)
      13:03:04,062 ERROR [ClientProxy] Cannot dispatch message
      javax.xml.ws.soap.SOAPFaultException: System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> TSAKeywordAnalysisServices.katAnalysisException: KAT Data Service Exception: ---> System.Exception: Target Page URL did not have any data.
      at clsDataService.getKATAnalysis(KATAnalysisCriteria request) in c:\Hudson\jobs\KAT Data Service\workspace\main\App_Code\clsDataService.cs:line 70
      at KATDataService10.getKATAnalysis(KATAnalysisCriteria request) in c:\Hudson\jobs\KAT Data Service\workspace\main\App_Code\KATDataService1.0.cs:line 27
      --- End of inner exception stack trace ---
      at KATDataService10.getKATAnalysis(KATAnalysisCriteria request) in c:\Hudson\jobs\KAT Data Service\workspace\main\App_Code\KATDataService1.0.cs:line 32
      --- End of inner exception stack trace ---
      at org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS.getSOAPFaultException(SOAPFaultHelperJAXWS.java:84)
      at org.jboss.ws.core.jaxws.binding.SOAP11BindingJAXWS.throwFaultException(SOAP11BindingJAXWS.java:107)
      at org.jboss.ws.core.CommonSOAPBinding.unbindResponseMessage(CommonSOAPBinding.java:579)
      at org.jboss.ws.core.CommonClient.invoke(CommonClient.java:381)
      at org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:290)
      at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:170)
      at org.jboss.ws.core.jaxws.client.ClientProxy.access$000(ClientProxy.java:60)
      at org.jboss.ws.core.jaxws.client.ClientProxy$AsyncRunnable.run(ClientProxy.java:260)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
      at java.util.concurrent.FutureTask.run(FutureTask.java:123)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
      at java.lang.Thread.run(Thread.java:595)