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 "Jacobo Sánchez López (JIRA)" <ax...@ws.apache.org> on 2014/02/26 16:41:22 UTC

[jira] [Created] (AXIS-2901) Invalid java.lang.String_Element reference generated in java class

Jacobo Sánchez López created AXIS-2901:
------------------------------------------

             Summary: Invalid java.lang.String_Element reference generated in java class 
                 Key: AXIS-2901
                 URL: https://issues.apache.org/jira/browse/AXIS-2901
             Project: Axis
          Issue Type: Bug
          Components: WSDL processing
    Affects Versions: 1.4
         Environment: Windows 7
            Reporter: Jacobo Sánchez López


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
	
	



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

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