You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Remy Bertrand <re...@free.fr> on 2006/05/10 22:12:10 UTC

[AXIS] 1.4 WSDL2Java generates non-compilable code

When WSDL contains <xsd:extension> in type definitions, wsdl2java can generate non compilable code.

I have identified 2 cases of non compilable code :

- Generated class don't extends anything, but a constructor calling super(...) is generated (in this case super refer to java.lang.Object).
- Generated class don't extends anything, a constructor initializing each attribute is generated, but attribute name is replaced by "paramx".

I wrote the attached wsdl that reproduce the two cases. Please focus on the schema part only, rest of the file is a poor cut and paste.


After looking in the code (wsdl/toJava/JavaBeanWriter.java), my understanding is that tests to decide if a class extends another or not (and thus what constructor(s) must be outputted) are not coherent.

- In method writeFullConstructor(), a test type.isSimpleType() is done to check if constructor must be written.
- In method writeSimpleConstructors(), a test extendType != null is done to check if constructor must be written.
- In method getExtendsText() (which is called to generate the "extends" statement at the beginning of the class), a more complex test is used: (extendType != null) && !isUnion() && (!type.isSimpleType() || !extendType.isBaseType()) && (extendType.getDimensions().length() == 0)

Thats why sometimes writeFullConstructor emits a constructor calling super(...) even if the class don't really inherits from anything.
Or why writeSimpleConstructors emits a constructor to initialize every attributes even if the informations to write this constructor are not available.


If you agree with my analyze, i can open a JIRA reports and submit a patch that i wrote trying to resolve the problem on my (multiple) wsdl.

Thanks 
Rémy Bertrand


Re: [AXIS] 1.4 WSDL2Java generates non-compilable code

Posted by Davanum Srinivas <da...@gmail.com>.
Please log a JIRA bug lest we forget.

thanks,
dims

On 5/16/06, Remy Bertrand <re...@free.fr> wrote:
> I join the modified version of JavaBeanWriter.java (in directory
> src/org/apache/axis/wsdl/toJava) source file, along with the diff with the
> version used in Axis 1.4.
>
> Let me know if it seems correct (it works on my thousand of WSDL files, but
> all of them use the same structure).
>
> I would be happy to know if this correction can be integrated in a future
> release.
> This could avoid me to keep track of this patched source.
>
> Thanks
>
> Rémy Bertrand
>
> ----- Original Message -----
> From: "Davanum Srinivas" <da...@gmail.com>
> To: <ax...@ws.apache.org>
> Sent: Friday, May 12, 2006 10:25 PM
> Subject: Re: [AXIS] 1.4 WSDL2Java generates non-compilable code
>
>
> Sure. Please  submit a patch
>
> thanks,
> dims
>
> On 5/10/06, Remy Bertrand <re...@free.fr> wrote:
> >
> >
> > When WSDL contains <xsd:extension> in type definitions, wsdl2java can
> > generate non compilable code.
> >
> > I have identified 2 cases of non compilable code :
> >
> > - Generated class don't extends anything, but a constructor calling
> > super(...) is generated (in this case super refer to java.lang.Object).
> > - Generated class don't extends anything, a constructor initializing each
> > attribute is generated, but attribute name is replaced by "paramx".
> >
> > I wrote the attached wsdl that reproduce the two cases. Please focus on
> the
> > schema part only, rest of the file is a poor cut and paste.
> >
> >
> > After looking in the code
> > (wsdl/toJava/JavaBeanWriter.java), my understanding is that
> > tests to decide if a class extends another or not (and thus what
> > constructor(s) must be outputted) are not coherent.
> >
> > - In method writeFullConstructor(), a test type.isSimpleType() is done to
> > check if constructor must be written.
> > - In method writeSimpleConstructors(), a test extendType != null is done
> to
> > check if constructor must be written.
> > - In method getExtendsText() (which is called to generate the "extends"
> > statement at the beginning of the class), a more complex test is used:
> > (extendType != null) && !isUnion() && (!type.isSimpleType() ||
> > !extendType.isBaseType()) && (extendType.getDimensions().length() == 0)
> >
> > Thats why sometimes writeFullConstructor emits a constructor calling
> > super(...) even if the class don't really inherits from anything.
> > Or why writeSimpleConstructors emits a constructor to initialize every
> > attributes even if the informations to write this constructor are not
> > available.
> >
> >
> > If you agree with my analyze, i can open a JIRA reports and submit a patch
> > that i wrote trying to resolve the problem on my (multiple) wsdl.
> >
> > Thanks
> > Rémy Bertrand
> >
> >
> >
>
>
> --
> Davanum Srinivas : http://wso2.com/blogs/
>
>
>


-- 
Davanum Srinivas : http://wso2.com/blogs/

Re: [AXIS] 1.4 WSDL2Java generates non-compilable code

Posted by Remy Bertrand <re...@free.fr>.
I join the modified version of JavaBeanWriter.java (in directory
src/org/apache/axis/wsdl/toJava) source file, along with the diff with the
version used in Axis 1.4.

Let me know if it seems correct (it works on my thousand of WSDL files, but
all of them use the same structure).

I would be happy to know if this correction can be integrated in a future
release.
This could avoid me to keep track of this patched source.

Thanks

Rémy Bertrand

----- Original Message ----- 
From: "Davanum Srinivas" <da...@gmail.com>
To: <ax...@ws.apache.org>
Sent: Friday, May 12, 2006 10:25 PM
Subject: Re: [AXIS] 1.4 WSDL2Java generates non-compilable code


Sure. Please  submit a patch

thanks,
dims

On 5/10/06, Remy Bertrand <re...@free.fr> wrote:
>
>
> When WSDL contains <xsd:extension> in type definitions, wsdl2java can
> generate non compilable code.
>
> I have identified 2 cases of non compilable code :
>
> - Generated class don't extends anything, but a constructor calling
> super(...) is generated (in this case super refer to java.lang.Object).
> - Generated class don't extends anything, a constructor initializing each
> attribute is generated, but attribute name is replaced by "paramx".
>
> I wrote the attached wsdl that reproduce the two cases. Please focus on
the
> schema part only, rest of the file is a poor cut and paste.
>
>
> After looking in the code
> (wsdl/toJava/JavaBeanWriter.java), my understanding is that
> tests to decide if a class extends another or not (and thus what
> constructor(s) must be outputted) are not coherent.
>
> - In method writeFullConstructor(), a test type.isSimpleType() is done to
> check if constructor must be written.
> - In method writeSimpleConstructors(), a test extendType != null is done
to
> check if constructor must be written.
> - In method getExtendsText() (which is called to generate the "extends"
> statement at the beginning of the class), a more complex test is used:
> (extendType != null) && !isUnion() && (!type.isSimpleType() ||
> !extendType.isBaseType()) && (extendType.getDimensions().length() == 0)
>
> Thats why sometimes writeFullConstructor emits a constructor calling
> super(...) even if the class don't really inherits from anything.
> Or why writeSimpleConstructors emits a constructor to initialize every
> attributes even if the informations to write this constructor are not
> available.
>
>
> If you agree with my analyze, i can open a JIRA reports and submit a patch
> that i wrote trying to resolve the problem on my (multiple) wsdl.
>
> Thanks
> Rémy Bertrand
>
>
>


-- 
Davanum Srinivas : http://wso2.com/blogs/

Re: [AXIS] 1.4 WSDL2Java generates non-compilable code

Posted by Davanum Srinivas <da...@gmail.com>.
Sure. Please  submit a patch

thanks,
dims

On 5/10/06, Remy Bertrand <re...@free.fr> wrote:
>
>
> When WSDL contains <xsd:extension> in type definitions, wsdl2java can
> generate non compilable code.
>
> I have identified 2 cases of non compilable code :
>
> - Generated class don't extends anything, but a constructor calling
> super(...) is generated (in this case super refer to java.lang.Object).
> - Generated class don't extends anything, a constructor initializing each
> attribute is generated, but attribute name is replaced by "paramx".
>
> I wrote the attached wsdl that reproduce the two cases. Please focus on the
> schema part only, rest of the file is a poor cut and paste.
>
>
> After looking in the code
> (wsdl/toJava/JavaBeanWriter.java), my understanding is that
> tests to decide if a class extends another or not (and thus what
> constructor(s) must be outputted) are not coherent.
>
> - In method writeFullConstructor(), a test type.isSimpleType() is done to
> check if constructor must be written.
> - In method writeSimpleConstructors(), a test extendType != null is done to
> check if constructor must be written.
> - In method getExtendsText() (which is called to generate the "extends"
> statement at the beginning of the class), a more complex test is used:
> (extendType != null) && !isUnion() && (!type.isSimpleType() ||
> !extendType.isBaseType()) && (extendType.getDimensions().length() == 0)
>
> Thats why sometimes writeFullConstructor emits a constructor calling
> super(...) even if the class don't really inherits from anything.
> Or why writeSimpleConstructors emits a constructor to initialize every
> attributes even if the informations to write this constructor are not
> available.
>
>
> If you agree with my analyze, i can open a JIRA reports and submit a patch
> that i wrote trying to resolve the problem on my (multiple) wsdl.
>
> Thanks
> Rémy Bertrand
>
>
>


-- 
Davanum Srinivas : http://wso2.com/blogs/