aspose file tools*
The moose likes Web Services Certification (SCDJWS/OCEJWSD) and the fly likes Conversion of service specific exceptions to Runtime exceptions in WS. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Services Certification (SCDJWS/OCEJWSD)
Bookmark "Conversion of service specific exceptions to Runtime exceptions in WS." Watch "Conversion of service specific exceptions to Runtime exceptions in WS." New topic
Author

Conversion of service specific exceptions to Runtime exceptions in WS.

Kumar Raja
Ranch Hand

Joined: Mar 18, 2010
Posts: 519
    
    2

Hi All,

In the section 11.3 Web Services Interaction Results, I read the following


The following are possible ways of handling service-specific exceptions in client applications:
• Wrap the checked service-specific exceptions and throw an unchecked exception.
• Notify the user of the client application that an error has occurred.
• Do not allow service-specific exceptions propagate throughout the client application, but rather wrap them in exceptions specific to the client application.

This limits the impact of changes in the web service interface.
• Handle exceptions at one single place in the client application.
Prevents duplication of code and limits impact of changes in the web service interface.


Why do we need to convert service specific exceptions to run time exceptions, espicially when one of the artifacts being generated contains the servicespecific exception.

Say for example, if my service throws CustomException and on client side (java), one of the artifacts generated would be CustomException_Exception. I think handling CustomException_Exception would be easy and straight forward than handling some ArithmeticException (division by zero) or some other sort. How does this work in non-java client, when java webservice throws ArithmeticException, instead of custom exception.

Can you please explain me on this ?


Regards
KumarRaja

Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
The idea is that you have a client "layer", containing the generated artifacts and the code the uses the generated artifacts.
If you let service-specific exceptions "escape" this layer, then any changes in the service and the exceptions it "throws" will affect the client beyond the above mentioned "layer".
If you, in this layer, wrap or translate service specific exceptions to other, general, exceptions then any changes in the service and the exceptions it "throws" will not affect anything beyond the "layer" in the client.
Best wishes!


My free books and tutorials: http://www.slideshare.net/krizsan
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Conversion of service specific exceptions to Runtime exceptions in WS.