On Mon, 2005-09-19 at 21:40 +0600, Eran Chinthaka wrote: > Hi Paul and all, > > Let me explain a bit on this fall handling mechanism in client code. > > Call api has two ways of getting notified if there is an error. One > can either receive the fault as a java exception or he can receive the > SOAP Fault in SOAP Body. > > The default is you will receive a java exception. But for you to > receive this error as an exception, the stack trace should come under > the Detail element,, under Exception element. > > <Envelope> > <Header /> > <Body> > <Detail> > <Exception> your exception goes here </Exception? > </Detail> > <Body> > </Envelope> > > This is sort of a mechanism is for the Call to work well with Axis2 > server. > > But if you want to receive the SOAP fault to the application, just set > setExceptionToBeThrownOnSOAPFault(false) in the call api. This will > give you back the Fault which you were looking for, without a java > exception.
A simple improvement: even when throwing a Java fault, just pass the SOAPFault as a property of the exception; that way anyone who wants access to all the fault data can get it. Also, its good to have direct properties for the normal SOAPFault stuff in AxisFault: String getFaultCode(), String getFaultString(), OMElement getFaultDetail() etc.. These can all return null if there's no associated SOAPFault in the Java exception. Sanjiva.
