FWIW, this is what I did when I had several types of different error messages to handle: http://www.jroller.com/gmazza/entry/database_crud_actions_with_web
HTH, Glen Petr V. wrote: > > Any one please ? > > Thanks, > > Petr > > --- On Wed, 3/4/09, Petr V. <[email protected]> wrote: > From: Petr V. <[email protected]> > Subject: Exception Inheritance Model > To: [email protected] > Date: Wednesday, March 4, 2009, 11:29 PM > > I have inheritance model in exception hierarchy but published wsdl via CXF > does > not show that. > > I did lil google and found that it is as per spec > > Dan replied below on following thread > > http://mail-archives.apache.org/mod_mbox/cxf-users/200803.mbox/%[email protected]%3e > > "As Glen mentioned, this is completely per spec. > > You can work around it SLIGHTLY by refactoring your exceptions to store > all their data in JAXB specified java beans (grabbed via getFaultInfo()) > that implement the same heiarchy. That said, when you run wsdl2java on > the wsdl to generate code from it, that heiarchy would not be honored in > the exceptions themselves. > > In anycase, this is all per spec." > So this raises new question. Since I am writing java first so all my > methods > throw the top exception class so in case if I need to throw some sub > classes, I > wont have to change function signature. But if service publish does not > maintain > hierarchy model so what would happen if some exception is thrown from > service > which is actuall ysub class of super class but not specified in wsdl, > Crash ? > Run Time Exception ? > > class TopException { > } > > class subException1 extends TopException { > } > > class subException2 extends TopException { > > } > > Method in service is > > public void foo() throws subException1 , TopException{ > ..... > } > > So generated wsdl would show that two exceptions could be thrown. > > So far so good but as we know that subException2 is inherited from > TopException1 so there is no stopping for throwing it from foo() > > So what if client calls service method foo() and foo() throws > subException2 > (java compiler wont complain as well as outside web services, code would > work > fine) but wsdl and generated proxy won't have no idea that subException2 > is > inherited from TopException1 so would it crash at run time? > > Does it mean that I need to explictly define every exception that could be > thrown from web services so it can show up in wsdl and should not rely on > inheritance model of exception. It would mean that I just flatten my > exception > model and live with that :-(. > > Is my understanding coprrect ? Am I missin gsoem thing? > > Any help would be appreciated to clarify my understanding and how to avoid > the > current situation. > > Thanks, > > Petr > > > > > > > > -- View this message in context: http://www.nabble.com/Exception-Inheritance-Model-tp22336256p22360240.html Sent from the cxf-user mailing list archive at Nabble.com.
