Hi Glen, first of all thanx for the reply, sorry for mine taking that long but I was busy with other things.
Unfortunately I could not really use the link you provided in your email. Maybe this is because I do not create the WSDL myself but have it created by CXF (I assume that is the whole idea behind CXF, shield the developer from the complexity of WSDL, SOAP, etc.). So my service interface throws some exceptions, e.g. : @WebService(targetNamespace="http://ac...../") public interface AccountService { public Long register(@WebParam(name="account") AccountDTO account) throws AccountException; public AccountDTO get(@WebParam(name="token") String token, @WebParam(name="id") Long id) throws InvalidSessionException, AccountException; public AccountDTO getSelf(@WebParam(name="token") String token) throws InvalidSessionException, AccountException; public void update(@WebParam(name="token") String token, @WebParam(name="account") AccountDTO account) throws InvalidSessionException;; public void delete(@WebParam(name="token") String token, @WebParam(name="id") Long id) throws InvalidSessionException; ... You can see that some methods might throw a InvalidSessionException, some others an AccountException, etc. Now looking at some tutorial from W3C Schools, each soap fault has: http://www.w3schools.com/SOAP/soap_fault.asp - faultcode, - faultstring, - faultactor, - detail To my surprise faultcode is a pretty basic list of just client/server, etc. but I guess I have to live with that. I was hoping to be able to provide an own list, but that's Soap and I cannot change that. So I assume that an Exception thrown by a sevice implementation is wrapped into a soap fault. the Faultcode will be server in this case (assuming CXF does this automaticaly), the faultstring would be the exception.getMessage() string, etc. Is this correct? If so, how can I control faultactor and detail? --- Maybe this is also just completely wrong. Should a service interface throw exceptions in the way I did it? In my case, I am just throwing a coarse-grained AccountException because I do not want to expose the real java exception to the outside world (potentially giving information to hackers on how to best attack, etc) Thanx a lot for all, CXF is just exactly what I need and I totally appreciate the user list and the great help it provides. Cheers Sven --- Sven Haiges Y! Messenger / Skype: hansamann ----- Original Message ---- From: Glen Mazza <[EMAIL PROTECTED]> To: [email protected] Sent: Thursday, July 17, 2008 6:08:40 PM Subject: Re: Soap Faults For the first issue, yes, I would say the errors should have separate namespaces even if they mean the same thing--if you're doing WSDL-first each of their WSDL's should have separate target namespaces anyway. For the second issue, this article[1] has both a wsdl-defined fault and a generic SOAPFaultException, as well as service providers and clients handling both of them. It may give you a little bit of coding guidance. HTH, Glen [1] http://www.jroller.com/gmazza/date/20080308 On Thu, 2008-07-17 at 15:01 -0700, Sven Haiges wrote: > Hi all, > > I realize something similar was just asked but still some of my issues are > not solved. > > My SOAP service may throw a few exceptions and as far as I understand, these > Exception object will be converted automatically by CFX. I created a java > client with wsdl2java and I can see the Exception classes automatically being > generated. Now two issues: > > - got 4 services, some of those service inerfaces share the same Exception > class. Still, after generating 4 clients for the services, each client > service package will have its own Exception class. This causes some confusion > and will confuse the users later. Can I fix this with changeing the > targetNameSpace or similar? > > - I read about outFaultInterceptors, but could not find more documentation in > the CXF user guide. Can someone point me to a really good resource about how > to map java exceptions to soap faults? > > Thanx > Sven > > --- > Sven Haiges > Y! Messenger / Skype: hansamann >
