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 David Urena <Da...@kxen.com> on 2004/08/19 15:39:54 UTC

WSDL2Java possible issue when generating beans from 'union' description

Hello,

I'm new in the Web Services, so I hope my question is not a well known topic.

I have a structured wsdl file referencing an xsd definition. The WSDL2Java tool, used with no parameter, generates the beans and the services skeletons java classes. What is great of course. But this generation is not good. It generates non valid code. The first kind of problem is around 'union' complex type as below:

-- in the XSD file
  <xsd:simpleType name="ActivationFunction">
    <xsd:union memberTypes="ActivationFunctionStd EnumerationExtension"/>
  </xsd:simpleType>

The code generated associated to this 'ActivationFunction' the following code:
    public ActivationFunction(XXX.ActivationFunctionStd value) {
        setValue(value);
    }
    public ActivationFunction(XXX.EnumerationExtension value) {
        setValue(value);
    }

But the method setValue() doesn't exist. The tool generated two other set method
    public void setActivationFunctionStdValue(XXX.ActivationFunctionStd value) { ... }
    public void setEnumerationExtensionValue(XXX.EnumerationExtension value) { ... }

This forces me to modify a lot of classes generated by the WSDL2Java by renaming the set methods with the name setValue or by renaming the setValue invocations by a valid function name.

Does this represent a bug in the WSDL2Java tool or 'union' are not supported.

The second problem is that the generated bean classes have get methods malformed. The 'return' key is catenated with the name of the package:
    public XXX.ActivationFunctionStd getActivationFunctionStdValue() {
        returnXXX.ActivationFunctionStd.fromString(value);
    }
Is this a known issue in the tool?

Thanks for your answers and comments.

David Ureña
Software Engineer
www.KXEN.com


Re: WSDL2Java possible issue when generating beans from 'union' description

Posted by Lee Coomber <le...@lshift.net>.
Hi David,

This has been recently fixed:-

http://issues.apache.org/jira/browse/AXIS-1444

Using the latest CVS version should solve your problem.

Lee

David Urena wrote:

>Hello,
>
>I'm new in the Web Services, so I hope my question is not a well known topic.
>
>I have a structured wsdl file referencing an xsd definition. The WSDL2Java tool, used with no parameter, generates the beans and the services skeletons java classes. What is great of course. But this generation is not good. It generates non valid code. The first kind of problem is around 'union' complex type as below:
>
>-- in the XSD file
>  <xsd:simpleType name="ActivationFunction">
>    <xsd:union memberTypes="ActivationFunctionStd EnumerationExtension"/>
>  </xsd:simpleType>
>
>The code generated associated to this 'ActivationFunction' the following code:
>    public ActivationFunction(XXX.ActivationFunctionStd value) {
>        setValue(value);
>    }
>    public ActivationFunction(XXX.EnumerationExtension value) {
>        setValue(value);
>    }
>
>But the method setValue() doesn't exist. The tool generated two other set method
>    public void setActivationFunctionStdValue(XXX.ActivationFunctionStd value) { ... }
>    public void setEnumerationExtensionValue(XXX.EnumerationExtension value) { ... }
>
>This forces me to modify a lot of classes generated by the WSDL2Java by renaming the set methods with the name setValue or by renaming the setValue invocations by a valid function name.
>
>Does this represent a bug in the WSDL2Java tool or 'union' are not supported.
>
>The second problem is that the generated bean classes have get methods malformed. The 'return' key is catenated with the name of the package:
>    public XXX.ActivationFunctionStd getActivationFunctionStdValue() {
>        returnXXX.ActivationFunctionStd.fromString(value);
>    }
>Is this a known issue in the tool?
>
>Thanks for your answers and comments.
>
>David Ureña
>Software Engineer
>www.KXEN.com
>
>  
>

-- 

  [][][] Lee Coomber    | Tel: +44 (0)20 7729 7060
    [][] LShift Ltd     | Email: lee@lshift.net
  []  [] www.lshift.net |