Normally, you would stick some checked exceptions on the method that has some 
properties (or even just the message) that you want to relay back to the 
client.    Those exceptions would then be part of the WSDL and thus part of 
the contract.   If the client is generated from that WSDL, the exception 
handling would pretty much be automatic.

Dan


On Thursday, November 03, 2011 8:24:09 AM [email protected] wrote:
> Hi,
> 
> I'm using the CXF for developing webservices.
> 
> But I was wondering what is Best Practice for handling exceptions? Let's say
> I have a webservice-operation, create(User user).
>  The incoming user is an instance of my User domain class, and can be saved
> directly by  the UI Team by calling  user.save()
> 
> If the save() for some reason fail (e.g. some Network connectivity  fail ,
> or some data validation error from User DTO ), how would Best Practice
> dictate that I serve this exception to the client?
> 
> I mean: Which type of Exception would be suitable?
> 
> Should this Exception be included in the operations signature ??
> 
> public Response createUser(User user);
> 
> @WebService
> public interface EmpService {
> public Response createUser(User user);
> }
> 
> And how should the client-side handle this exception?
> 
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/Handling-Exceptions-in-Apache-CXF-tp4961369
> p4961369.html Sent from the cxf-user mailing list archive at Nabble.com.
-- 
Daniel Kulp
[email protected]
http://dankulp.com/blog
Talend - http://www.talend.com

Reply via email to