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 "Lars Stoustrup (JIRA)" <ax...@ws.apache.org> on 2007/06/18 12:49:25 UTC

[jira] Commented: (AXIS-2605) WSDL2Java generates uncompilable code for EBXML messaging schema

    [ https://issues.apache.org/jira/browse/AXIS-2605?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12505768 ] 

Lars Stoustrup commented on AXIS-2605:
--------------------------------------

I have encountered this problem as well - fixing seems fairly simple though. I have modified a constructor emitted by the 'protected void writeSimpleConstructors()' method in src\org\apache\axis\wsdl\toJava\JavaBeanWriter.java to not call it's super constructor. 
The core of the problem is that while parsing the .wsdl file, AXIS determines that the base type for the extended type in Joshua's example is String - this is correct. But the emitted code is based on the assumption that the base type has a super type with a constructor that takes a String as an argument - this is wrong.
While this fix works for me, I cannot immediately assert that it won't break something else. I provide the fix as-is with a promise to follow up on it :-)

> WSDL2Java generates uncompilable code for EBXML messaging schema
> ----------------------------------------------------------------
>
>                 Key: AXIS-2605
>                 URL: https://issues.apache.org/jira/browse/AXIS-2605
>             Project: Axis
>          Issue Type: Bug
>          Components: WSDL processing
>    Affects Versions: 1.4
>         Environment: Duplicated on both Linux 2.6 and Windows 2000, Java version 1.5.0_06-b05
>            Reporter: Joshua Davies
>         Attachments: fail.wsdl
>
>
> I'm working against a WSDL (which I was given and can't change), that depends on ("<import>s") the EBXML message service specification (http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2_0.xsd).  Unfortunately, WSDL2Java generates uncompilable code when the WSDL includes the referenced msg-header-2_0.xsd file.
> After some digging, I believe I was able to narrow down the problem, and created a much smaller standalone wsdl that duplicates the problem exactly.  The attached sample code generates uncompilable code.  The problem appears to occur here (in the WSDL):
>   <schema targetNamespace="http://www.fail.com/nes"
>           xmlns:tns="http://www.fail.com/nes"
>           xmlns="http://www.w3.org/2001/XMLSchema">
>     <simpleType name="non-empty-string">
>       <restriction base="string">
>         <minLength value="1" />
>       </restriction>
>     </simpleType>
>     <element name="Top">
>       <complexType>
>         <simpleContent>
>           <extension base="tns:non-empty-string">
>             <attribute name="type" type="tns:non-empty-string" />
>           </extension>
>         </simpleContent>
>       </complexType>
>     </element>
>   </schema>
> This generates the following code:
> package com.fail.www.nes;
> public class Top  implements java.io.Serializable, org.apache.axis.encoding.Simp
> leType {
>     private java.lang.String type;  // attribute
>     public Top() {
>     }
>     // Simple Types must have a String constructor
>     public Top(java.lang.String _value) {
>         super(_value);
>     }
> Which, of course, fails with the following complie error:
> com/fail/www/nes/Top.java:18: Object() in java.lang.Object cannot be applied to
> (java.lang.String)
>         super(_value);
>         ^
> 1 error
> Because the code in question invokes a superconstructor but doesn't extend any other class.  I'm assuming that the problem is in the use of the "extension" element, since if I remove that section, the generated code compiles just fine.
> I'll attach the WSDL that I created that duplicates this.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org