axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Davanum Srinivas <dava...@gmail.com>
Subject Re: Problem with referenced elements in wsdl2java
Date Mon, 08 Aug 2005 15:15:14 GMT
Could you please open a bug report?

thanks,
dims

On 8/8/05, Richard Persche <rpersche@us.hyperwave.com> wrote:
>  
>  
> 
> Hi, 
> 
>   
> 
> I am not an Axis developer but I think I found a problem with Axis 1.2.1 
> (same behavior with Axis 1.3 observed by Joe Nall) which I want to share
> with you. 
> 
>   
> 
> When a wsdl contains elements that are defined by ref="xzy" 
> 
>   
> 
> […] 
> 
>             <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); 
> 
> [..] 
> 
>   
> 
>   
> 
> I hope it is ok to send an email to this mailing list. 
> 
>   
> 
> Regards 
> 
>   
> 
> Richard 
>  
> 
> H 
>  
> 
> Richard Persché 
> 
> Senior Systems Consultant 
> 
> Tel. 617.901.4175 
> 
> Fax 617.507.8425 
> 
> richard.persche@hyperwave.com 
> 
> www.hyperwave.com 
>  
> 
>  
> 
>   


-- 
Davanum Srinivas -http://blogs.cocoondev.org/dims/
Mime
View raw message