Uploaded image for project: 'Axis'
  1. Axis
  2. AXIS-2901

Invalid java.lang.String_Element reference generated in java class

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.4
    • Fix Version/s: None
    • Component/s: WSDL processing
    • Labels:
    • Environment:
      Windows 7

      Description

      Using WSDL2Java for a wsdl using references and specifying a target namespace with "-p" option creates
      beans that declare variables as "java.lang.String_Element". Using SOAPUi to generate code with options:
      command: [java, -cp, <classpath>, org.apache.axis.wsdl.WSDL2Java, -v, -T, 1.2, -p, test.package, -o, C:\outputfolder, C:\wsdlroute\wsdlfile.wsdl]
      Name.java contains:
      private java.lang.String_Element firstElement;

      private java.lang.String_Element secondElement;

      private java.lang.String thirdElement;

      and it does not compile.

      I found two workarounds to avoid this:

      1) Modify WSDL by replacing references:
      <xs:element name="Names">
      <xs:complexType>
      <xs:sequence>
      <xs:element ref="ns0:FirstElement"/>
      <xs:element ref="ns0:SecondElement"/>
      </xs:sequence>
      </xs:complexType>
      </xs:element>
      <xs:element name="FirstElement" type="xs:string"/>
      <xs:element name="SecondElement" type="xs:string"/>

      with

      <xs:element name="Names">
      <xs:complexType>
      <xs:sequence>
      <xs:element name="FirstElement" type="xs:string"/>
      <xs:element name="SecondElement" type="xs:string"/>
      </xs:sequence>
      </xs:complexType>
      </xs:element>

      2) Modifying JavaGeneratorFactory.java
      } else if (name.equals(entry.getName()))

      { resolve = true; // Need to do resolution }

      for:

      } else if (name.equals(entry.getName())) {
      resolve = true; // Need to do resolution
      if(entry instanceof DefinedElement) {
      if(((DefinedElement) entry).isBaseType())

      { resolve = false; }

      }
      }

      which is too ad-hoc but works for me

      I have another issue with SOAP generated for request in this kind of WSDL with
      <xs:element ref="ns0:Names" minOccurs="0" maxOccurs="unbounded"/>
      <xs:element name="Names">
      ...
      generating
      <item xmlns="">
      instead of <Names> (as i think it should) but will open a different issue for it

        Attachments

        1. sample.wsdl
          4 kB
          Jacobo Sánchez López

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              jacobo Jacobo Sánchez López
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: