You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Sebastian Schneider <sc...@dvz.fh-aachen.de> on 2009/09/22 08:46:26 UTC

Naming of parameters and exceptions

Hello everybody,

I got a question regarding the naming of parameters and exceptions in the generated stub code for the client. Why are numbers added to the parameter names?

For example, if my service method looked like findUserByName(String name) after generating the stub client from the WSDL file I would find a method findUserByName(String name12) or something in the stub. What is the reason for this and can this behaviour be disabled?

I still do not have found out why sometimes the word "Exception" is added to custom Exception classes and sometimes it is not?? If I have an Exception-class called MyException in the service implementation I sometimes find an inner class in the service stub which is called MyExceptionException instead of MyException

I am using Axis2-1.5. Data binding is done by ADB.

Thank your for any hints and explainations regarding this.

Best regards,
Sebastian

Re: Naming of parameters and exceptions

Posted by Sebastian Schneider <sc...@dvz.fh-aachen.de>.
Hello everybody!

Amila Suriarachchi wrote:
> 
> 
> On Tue, Sep 22, 2009 at 12:16 PM, Sebastian Schneider 
> <schneider@dvz.fh-aachen.de <ma...@dvz.fh-aachen.de>> wrote:
> 
>     I still do not have found out why sometimes the word "Exception" is
>     added to custom Exception classes and sometimes it is not?? If I
>     have an Exception-class called MyException in the service
>     implementation I sometimes find an inner class in the service stub
>     which is called MyExceptionException instead of MyException
> 
> 
> if there is an wsd:fault message for an operation it generates an 
> exception class for that which has the sufix 'Exception'. But if you 
> have a schema element with the name MyException it generates an ADB 
> class for that and does not add a sufix.

I appreciate the answer very much but for my specific case what is the 
conclusion if I want to use my own exception classes leaving their names 
untouched? Do I really need to name my exception classes in the service 
implementation without the suffix Exception to afterwards just have one 
Exception-suffix in the generated code? Or does this mean I just have to 
tweak the configuration?

Thanks a lot for any help

Sebastian

-- 
Mit freundlichen Grüßen / Best regards / meilleures salutations

Sebastian Schneider <sc...@dvz.fh-aachen.de>
Tel. 0 24 05 / 45 28 95 9

Re: Naming of parameters and exceptions

Posted by Sebastian Schneider <sc...@dvz.fh-aachen.de>.
Hello Amila, hello everybody

first of all thank you for your answer. 

> > I got a question regarding the naming of parameters and exceptions 
> > in the generated stub code for the client. Why are numbers added to the parameter
> > names?

> this is a technique done to avoid any possible compilation issues.

And there is no way to disable this? I chose my parameter and method names carefully to ease things for the developers using my webservice. I do not see how compilation issues could arise from parameter names.

> > I still do not have found out why sometimes the word "Exception" is 
> added to custom Exception classes and sometimes it is not?? If I have an
> > Exception-class called MyException in the service implementation I sometimes
> > find an inner class in the service stub which is called MyExceptionException
> > instead of MyException

> if there is an wsd:fault message for an operation it generates an exception
> class for that which has the sufix 'Exception'. But if you have a schema
> element with the name MyException it generates an ADB class for that and
> does not add a sufix.

I am still new to Axis/Axis2. I created an interface and afterwards an implementation of this interface. Then I used the Eclipse's Webservice wizard selecting the Bottom-Up-Method pointing the wizard to my implementation. Finally I used the Service Archiver to export my webservice. My service implementation includes exception classes I created and since they are Exceptions they are all named in this way: MyFirstCustomException, MySecondException.

Is it necessary to create a schema to avoid this behaviour? If yes, how do I start?

Best regards and thank you for your help,
Sebastian

Re: Naming of parameters and exceptions

Posted by Amila Suriarachchi <am...@gmail.com>.
On Tue, Sep 22, 2009 at 12:16 PM, Sebastian Schneider <
schneider@dvz.fh-aachen.de> wrote:

> Hello everybody,
>
> I got a question regarding the naming of parameters and exceptions in the
> generated stub code for the client. Why are numbers added to the parameter
> names?
>
> For example, if my service method looked like findUserByName(String name)
> after generating the stub client from the WSDL file I would find a method
> findUserByName(String name12) or something in the stub. What is the reason
> for this and can this behaviour be disabled?
>
this is a technique done to avoid any possible compilation issues.

>
> I still do not have found out why sometimes the word "Exception" is added
> to custom Exception classes and sometimes it is not?? If I have an
> Exception-class called MyException in the service implementation I sometimes
> find an inner class in the service stub which is called MyExceptionException
> instead of MyException
>

if there is an wsd:fault message for an operation it generates an exception
class for that which has the sufix 'Exception'. But if you have a schema
element with the name MyException it generates an ADB class for that and
does not add a sufix.

thanks,
Amila.

>
> I am using Axis2-1.5. Data binding is done by ADB.
>
> Thank your for any hints and explainations regarding this.
>
> Best regards,
> Sebastian
>



-- 
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/