axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Davanum Srinivas (JIRA)" <axis-...@ws.apache.org>
Subject [jira] Reopened: (AXIS-2170) WSDL2JAVA does not create proper code for referenced elements
Date Tue, 23 Aug 2005 02:02:09 GMT
     [ http://issues.apache.org/jira/browse/AXIS-2170?page=all ]
     
Davanum Srinivas reopened AXIS-2170:
------------------------------------

     Assign To: Davanum Srinivas

> WSDL2JAVA does not create proper code for referenced elements
> -------------------------------------------------------------
>
>          Key: AXIS-2170
>          URL: http://issues.apache.org/jira/browse/AXIS-2170
>      Project: Apache Axis
>         Type: Bug
>   Components: WSDL processing
>     Versions: 1.2.1
>  Environment: JRE 1.4.2_03, Win XP, 
>     Reporter: Richard Persche
>     Assignee: Davanum Srinivas
>     Priority: Blocker

>
> When a wsdl contains elements that are defined by ref=?xzy? the code produced by wsdl2java
does not look correct: 
> E.g. 
> [?]
>             <xs:element name="countryCode" type="CompoundCountryCodeIdentifierType"
nillable="true"/>
>             <xs:element name="geoRef" type="CompoundGeoRefIdentifierType" nillable="true"/>
>             <xs:complexType name="MyType">
>                         <xs:choice>
>                                     <xs:sequence>
>                                                 <xs:element name="name" type="xs:string"/>
>                                                 <xs:element name="region" type="xs:string"
nillable="true" minOccurs="0"/>
>                                                 <xs:element ref="geoRef" minOccurs="0"
maxOccurs="unbounded"/>
>                                                 <xs:element ref="countryCode" minOccurs="0"/>
>                                     </xs:sequence>
>                                     <xs:sequence>
>                                                 <xs:element name="myIdentifier" type="MyIdentifierType"
nillable="true" minOccurs="0"/>
>                                     </xs:sequence>
>                         </xs:choice>
>             </xs:complexType>
> [?]
>  
> the code produced by wsdl2java does not look correct: 
>  
> Code:
> MyType.java
>      private static org.apache.axis.description.TypeDesc typeDesc =
>         new org.apache.axis.description.TypeDesc(MyType.class, true);
>  
>     static {
>         typeDesc.setXmlType(new javax.xml.namespace.QName("http://www.dod.mil/ddms/1.0/ddms#",
"MyType"));
>         org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
>         elemField.setFieldName("name");
>         elemField.setXmlName(new javax.xml.namespace.QName("http://www.dod.mil/ddms/1.0/ddms#",
"name"));
>         elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema",
"string"));
>         elemField.setNillable(false);
>         typeDesc.addFieldDesc(elemField);
>         elemField = new org.apache.axis.description.ElementDesc();
>         elemField.setFieldName("region");
>         elemField.setXmlName(new javax.xml.namespace.QName("http://www.dod.mil/ddms/1.0/ddms#",
"region"));
>         elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema",
"string"));
>         elemField.setMinOccurs(0);
>         elemField.setNillable(true);
>         typeDesc.addFieldDesc(elemField);
>         elemField = new org.apache.axis.description.ElementDesc();
>         elemField.setFieldName("geoRef");
>         elemField.setXmlName(new javax.xml.namespace.QName("http://www.dod.mil/ddms/1.0/ddms#",
"geoRef"));
>         elemField.setXmlType(new javax.xml.namespace.QName("http://www.dod.mil/ddms/1.0/ddms#",
"geoRef"));
>         elemField.setMinOccurs(0);
>         elemField.setNillable(false);
>         elemField.setMaxOccursUnbounded(true);
>         typeDesc.addFieldDesc(elemField);
>         elemField = new org.apache.axis.description.ElementDesc();
>         elemField.setFieldName("countryCode");
>         elemField.setXmlName(new javax.xml.namespace.QName("http://www.dod.mil/ddms/1.0/ddms#",
"countryCode"));
>         elemField.setXmlType(new javax.xml.namespace.QName("http://www.dod.mil/ddms/1.0/ddms#",
"countryCode"));
>         elemField.setMinOccurs(0);
>         elemField.setNillable(false);
>         typeDesc.addFieldDesc(elemField);
>         elemField = new org.apache.axis.description.ElementDesc();
>         elemField.setFieldName("MyIdentifier");
>         elemField.setXmlName(new javax.xml.namespace.QName("http://www.dod.mil/ddms/1.0/ddms#",
"myIdentifier"));
>         elemField.setXmlType(new javax.xml.namespace.QName("http://www.dod.mil/ddms/1.0/ddms#",
"MyIdentifierType"));
>         elemField.setMinOccurs(0);
>         elemField.setNillable(true);
>         typeDesc.addFieldDesc(elemField);
>     }
>  
> When I added the following code to the JavaBeanHelperWriter.java to handle referenced
types, the code was created correctly. (see below)
>  
> 1_2_1/src/org/apache/axis/wsdl/toJava/JavaBeanHelperWriter.java
> Lines 345++
>                     xmlType = elemType.getQName();
>  
>                     //check ref type
>                     if (elemType != null &&
>                            elemType.getRefType() != null &&
>                            elemType.getRefType().getQName() != null) {
>                               xmlType = elemType.getRefType().getQName();
>                             }
>  
>  
> [?]
>         typeDesc.addFieldDesc(elemField);
>         elemField = new org.apache.axis.description.ElementDesc();
>         elemField.setFieldName("geoRef");
>         elemField.setXmlName(new javax.xml.namespace.QName("http://www.dod.mil/ddms/1.0/ddms#",
"geoRef"));
>         elemField.setXmlType(new javax.xml.namespace.QName("http://www.dod.mil/ddms/1.0/ddms#",
"CompoundGeoRefIdentifierType"));
>         elemField.setMinOccurs(0);
>         elemField.setNillable(false);
>         elemField.setMaxOccursUnbounded(true);
>         typeDesc.addFieldDesc(elemField);
>         elemField = new org.apache.axis.description.ElementDesc();
>         elemField.setFieldName("countryCode");
>         elemField.setXmlName(new javax.xml.namespace.QName("http://www.dod.mil/ddms/1.0/ddms#",
"countryCode"));
>         elemField.setXmlType(new javax.xml.namespace.QName("http://www.dod.mil/ddms/1.0/ddms#",
"CompoundCountryCodeIdentifierType"));
>         elemField.setMinOccurs(0);
>         elemField.setNillable(false);
> [..]
>  

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message