Hi,
AFAIR the reason is that since we are supporting different databinding
frameworks,  it is not always possible to generate a class that
extends exception. The databinding tools only look at the schema and
hence have no idea which elements are targeted towards exceptions.
You can definitely tweak the ADB framework but it will be harder (if
not impossible) to achieve this across all the other frameworks (such
as XMLBeans, Jaxb , Jibx etc)

So we have taken the generic path - where the exception contains the
databound object.

Ajith

On 6/5/07, James Englert <[EMAIL PROTECTED]> wrote:
As a side question, is there a way to avoid this:

MyFault fault = new MyFault();
MyFaultException faultEx = new MyFaultException();
fault.setMessage("Your Exception Message");
faultEx.setFaultMessage (fault);
throw faultEx;

in favor of

MyFaultException faultEx = new MyFaultException();
faultEx.setFaultMessage("Your Exception Here");
throw faultEx;

I see how this could be done by changing the templates that generate the
axis code but that seems to be a poor practice IMO.   I assume there is a
pretty good reason it wasn't done, any idea what that reason might be?



On 6/5/07, Raghu Upadhyayula <[EMAIL PROTECTED]> wrote:
> Dims,
>
>         From the WSDL2Java documentation it says that -g option is only
> valid with the -ss (generate server side code) option.
>
>         But in Fran's case, he is generating the client code and he is
> not seeing the MyFault class but he is seeing the MyFaultException
> class.
>
> Fran,
>
>         I think the way WSDL2Java creates the fault classes is changed
> in Axis2, at least from what I saw when I generated my client code.
>
>         It doesn't generate the Fault class, but generates the
> FaultException class which has the Fault as a member in it.
>
>         To raise the exception on your Server side, you have to do this.
>
----------------------------------------------------------------
>         MyFault fault = new MyFault();
>         MyFaultException faultEx = new MyFaultException();
>       fault.setMessage("Your Exception Message");
>         faultEx.setFaultMessage(fault);
>         throw faultEx;
>
>         To catch the Exception on your client side and get the exception
> msg.
>
>
---------------------------------------------------------------------
>         try {
>          ....
>         } catch (MyFaultException myFaultEx) {
>           System.out.println(myFaultEx.getFaultMessage().getMessage());
>             // getMessage returns your message set by the server
>       }
>
>         Hope this helps.
>
> Thanks
> Raghu
>
> -----Original Message-----
> From: Davanum Srinivas [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, June 05, 2007 6:12 AM
> To: [email protected]
> Subject: Re: [AXIS2] Throwing exceptions with ADB
>
> Fran,
>
> Did you try "-g" option in wsdl2java when generating the client?
>
> thanks,
> dims
>
> On 6/5/07, Fran <[EMAIL PROTECTED]> wrote:
> > Hi, list!
> >
> > I have a problem throwing Exceptions from service to client, using
> ADB.
> >
> > I create a service with Exceptions in some methods, I compile this
> > class and I create WSDL with Java2WSDL tool. In this WSDL I change
> > these lines:
> >
> > <xs:element name="MyFault">
> >        <xs:complexType>
> >                <xs:sequence>
> >                        <xs:element name="message"
type="xs:string" />
> >                </xs:sequence>
> >        </xs:complexType>
> > </xs:element>
> >
> > So I can send a message to client in the fault, also I change the
> > services.xml file adding Faults to the respective methods.
> >
> > And now I compile service like I do before change WSDL and all is ok,
> > but when I try to compile client, the client hasn't got the file of
> > MyFault class, it has only MyFaultException class.
> >
> > My doubt is, do I have to copy manually the Fault class files? The
> > WSDL2Java tool has an option to create Fault class files in client
> > side, like it does in service side?
> >
> > Thanks a lot!
> >
> > --
> > Saludos
> >
> > Fran
> >
> >
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
[EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> --
> Davanum Srinivas :: http://davanum.wordpress.com
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
[EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
[EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>




--
Ajith Ranabahu

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to