You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "Kyle.Bober" <ky...@gmail.com> on 2009/06/03 16:13:43 UTC

Issue with Asynchronous Callback and SOAPFaultException handling

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 recieves a
response at all. 

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<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);
		}
      }
}

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


-- 
View this message in context: http://www.nabble.com/Issue-with-Asynchronous-Callback-and-SOAPFaultException-handling-tp23852265p23852265.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Issue with Asynchronous Callback and SOAPFaultException handling

Posted by Daniel Kulp <dk...@apache.org>.
Upgrade to CXF 2.2.2.    We've added a bunch of tests and fixes and such 
around exceptions with the Async methods.

Dan


On Wed June 3 2009 10:15:23 am Kyle.Bober wrote:
> 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<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);
> 		}
>       }
> }
>
> 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

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog