2007/6/5, Raghu Upadhyayula <[EMAIL PROTECTED]>:
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]



Thanks Raghu! Your code is just that I wanted, it works perfect!

--
Saludos

Fran

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

Reply via email to