[ 
https://issues.apache.org/jira/browse/AXIS-2901?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

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

    Attachment: sample.wsdl

WSDL to reproduce the issue

> 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
>              Labels: wsdl2java
>         Attachments: sample.wsdl
>
>
> 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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to