Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.4.1
    • Fix Version/s: 1.6.3, 1.7.0
    • Component/s: adb, codegen
    • Labels:
      None

      Description

      Generating java classes using wsdl2java (as ADBBeans) (Axis2 version 1.4.1)
      on WSDL containing the following information:

      <xs:complexType name="PaymentAmount">
      <xs:simpleContent>
      <xs:extension base="tns:Amount"/>
      </xs:simpleContent>
      </xs:complexType>
      <xs:complexType name="Amount">
      <xs:simpleContent>
      <xs:extension base="xs:decimal">
      <xs:attribute name="currency" type="tns:currency" use="required"/>
      </xs:extension>
      </xs:simpleContent>
      </xs:complexType>

      The generated PaymentAmount class has no setter or getter methods.
      The generated Amount class has as expected setter and getter method for Currency and Decimal.

      1. SoapService.wsdl
        5 kB
        Aaron Gourley
      2. gencode.zip
        50 kB
        Aaron Gourley
      3. SchemaCompiler.java.patch
        3 kB
        Aaron Gourley

        Activity

        Hide
        Hudson added a comment -

        Integrated in Axis2 #1640 (See https://builds.apache.org/job/Axis2/1640/)
        Fixed AXIS2-4193.

        • Added support to generate code for types with nested extensions.
        • Make sure mergeBeanWriterMetaInfoHolderForRestriction() method only apply for restrictions.
        • Improved XSD extension test coverage. (Revision 1362377)

        Result = FAILURE
        sagara :
        Files :

        • /axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java
        • /axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java
        • /axis/axis2/java/core/trunk/modules/adb-codegen/test-resources/testsuite/extensions.xsd
        • /axis/axis2/java/core/trunk/modules/adb-codegen/test/org/apache/axis2/schema/extension/SimpleExtensionTest.java
        Show
        Hudson added a comment - Integrated in Axis2 #1640 (See https://builds.apache.org/job/Axis2/1640/ ) Fixed AXIS2-4193 . Added support to generate code for types with nested extensions. Make sure mergeBeanWriterMetaInfoHolderForRestriction() method only apply for restrictions. Improved XSD extension test coverage. (Revision 1362377) Result = FAILURE sagara : Files : /axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java /axis/axis2/java/core/trunk/modules/adb-codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java /axis/axis2/java/core/trunk/modules/adb-codegen/test-resources/testsuite/extensions.xsd /axis/axis2/java/core/trunk/modules/adb-codegen/test/org/apache/axis2/schema/extension/SimpleExtensionTest.java
        Hide
        Sagara Gunathunga added a comment -

        Fixed in r1362377.

        Show
        Sagara Gunathunga added a comment - Fixed in r1362377.
        Hide
        Aaron Gourley added a comment -

        I am not familiar with how to run the unit tests. Feel free to find another way to implement this fix if the failures are legitimate. In either case, I've come across 3 WSDLs that are syntactically valid that exploit this issue (one from Microsoft, one from Telus, and one created in house). The sample that I've uploaded exploits the issue concisely.

        Show
        Aaron Gourley added a comment - I am not familiar with how to run the unit tests. Feel free to find another way to implement this fix if the failures are legitimate. In either case, I've come across 3 WSDLs that are syntactically valid that exploit this issue (one from Microsoft, one from Telus, and one created in house). The sample that I've uploaded exploits the issue concisely.
        Hide
        Amila Chinthaka Suriarachchi added a comment -

        this patch causes some unit test failurs. please have a look.

        Show
        Amila Chinthaka Suriarachchi added a comment - this patch causes some unit test failurs. please have a look.
        Hide
        Aaron Gourley added a comment -

        I think I found an issue and was able to generate the code with the type hierarchy created properly. I've attached a patch file with my changes.

        Show
        Aaron Gourley added a comment - I think I found an issue and was able to generate the code with the type hierarchy created properly. I've attached a patch file with my changes.
        Hide
        Aaron Gourley added a comment -

        Attaching a small sample WSDL that reproduces the issue. Here are the arguments that I'm passing to WSDL2Java (Axis2 1.5.1):

        -p webservice.test -o /workspace/codegen/ -S src\java -R classes\webservice\test --noBuildXML --noWSDL -g -ss -ssi -sd -d adb -wv 1.1 -ns2p http://schemas.test.com/webservices/2006=webservice.test.types._2006,http://schemas.test.com/webservices/2009=webservice.test.types._2009,http://test.com/wsdl/types/=webservice.test.types -uw -u -Euwc -uri /workspace/src/wsdl/SoapService.wsdl

        I've also attached the generated code. Things to notice:

        1. Reference class is correctly defined as:
        public class Reference extends webservice.test.types.Guid implements org.apache.axis2.databinding.ADBBean

        2. ComplexReference is correctly defined as:
        public class ComplexReference extends webservice.test.types.CGuid implements org.apache.axis2.databinding.ADBBean

        3. ConcreteComplexReference and ReallyConcreteComplexReference are correctly defined as:
        public class ConcreteComplexReference extends webservice.test.types._2006.ComplexReference implements org.apache.axis2.databinding.ADBBean
        public class ReallyConcreteComplexReference extends webservice.test.types._2006.ConcreteComplexReference implements org.apache.axis2.databinding.ADBBean

        3. ConcreteReference and ReallyConcreteReference do not extend the parent classes properly:
        public class ConcreteReference implements org.apache.axis2.databinding.ADBBean
        public class ReallyConcreteReference implements org.apache.axis2.databinding.ADBBean

        This tells me that the problem is somewhere in the processing of complex types that are extensions of simple content. This appears to only be a problem when a conplex type extends another complex type but both contain simple content (i.e. type hierarchy is more than 2 levels deep).

        Show
        Aaron Gourley added a comment - Attaching a small sample WSDL that reproduces the issue. Here are the arguments that I'm passing to WSDL2Java (Axis2 1.5.1): -p webservice.test -o /workspace/codegen/ -S src\java -R classes\webservice\test --noBuildXML --noWSDL -g -ss -ssi -sd -d adb -wv 1.1 -ns2p http://schemas.test.com/webservices/2006=webservice.test.types._2006,http://schemas.test.com/webservices/2009=webservice.test.types._2009,http://test.com/wsdl/types/=webservice.test.types -uw -u -Euwc -uri /workspace/src/wsdl/SoapService.wsdl I've also attached the generated code. Things to notice: 1. Reference class is correctly defined as: public class Reference extends webservice.test.types.Guid implements org.apache.axis2.databinding.ADBBean 2. ComplexReference is correctly defined as: public class ComplexReference extends webservice.test.types.CGuid implements org.apache.axis2.databinding.ADBBean 3. ConcreteComplexReference and ReallyConcreteComplexReference are correctly defined as: public class ConcreteComplexReference extends webservice.test.types._2006.ComplexReference implements org.apache.axis2.databinding.ADBBean public class ReallyConcreteComplexReference extends webservice.test.types._2006.ConcreteComplexReference implements org.apache.axis2.databinding.ADBBean 3. ConcreteReference and ReallyConcreteReference do not extend the parent classes properly: public class ConcreteReference implements org.apache.axis2.databinding.ADBBean public class ReallyConcreteReference implements org.apache.axis2.databinding.ADBBean This tells me that the problem is somewhere in the processing of complex types that are extensions of simple content. This appears to only be a problem when a conplex type extends another complex type but both contain simple content (i.e. type hierarchy is more than 2 levels deep).
        Hide
        Aaron Gourley added a comment -

        I have also seen this issue in Axis2 1.5.1 with the following schema definition:

        <s:simpleType name="guid">
        <s:restriction base="s:string">
        <s:pattern value="[0-9a-fA-F]

        {8}

        -[0-9a-fA-F]

        {4}-[0-9a-fA-F]{4}

        -[0-9a-fA-F]

        {4}

        -[0-9a-fA-F]

        {12}

        " />
        </s:restriction>
        </s:simpleType>

        <s:complexType name="CrmReference">
        <s:simpleContent>
        <s:extension base="s2:guid">
        <s:attribute name="IsNull" type="s:boolean" />
        <s:attribute name="name" type="s:string" />
        <s:attribute name="type" type="s:string" />
        <s:attribute name="dsc" type="s:int" />
        </s:extension>
        </s:simpleContent>
        </s:complexType>
        <s:complexType name="Owner">
        <s:simpleContent>
        <s:extension base="s1:CrmReference" />
        </s:simpleContent>
        </s:complexType>

        In my case, CrmReference is generated to extend the generated Guid class as expected, so it has the getters/setters from the super class. That being said, the Owner class is not generated to extend the generated CrmReference class so there are no getters/setters for any base types up the hierarchy from it.

        Show
        Aaron Gourley added a comment - I have also seen this issue in Axis2 1.5.1 with the following schema definition: <s:simpleType name="guid"> <s:restriction base="s:string"> <s:pattern value=" [0-9a-fA-F] {8} - [0-9a-fA-F] {4}- [0-9a-fA-F] {4} - [0-9a-fA-F] {4} - [0-9a-fA-F] {12} " /> </s:restriction> </s:simpleType> <s:complexType name="CrmReference"> <s:simpleContent> <s:extension base="s2:guid"> <s:attribute name="IsNull" type="s:boolean" /> <s:attribute name="name" type="s:string" /> <s:attribute name="type" type="s:string" /> <s:attribute name="dsc" type="s:int" /> </s:extension> </s:simpleContent> </s:complexType> <s:complexType name="Owner"> <s:simpleContent> <s:extension base="s1:CrmReference" /> </s:simpleContent> </s:complexType> In my case, CrmReference is generated to extend the generated Guid class as expected, so it has the getters/setters from the super class. That being said, the Owner class is not generated to extend the generated CrmReference class so there are no getters/setters for any base types up the hierarchy from it.

          People

          • Assignee:
            Sagara Gunathunga
            Reporter:
            Roger Niederland
          • Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development