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 "Enrique Fernández (JIRA)" <ax...@ws.apache.org> on 2006/07/14 15:02:14 UTC

[jira] Commented: (AXIS-2523) WSDL wrong code generation using xs:union

    [ http://issues.apache.org/jira/browse/AXIS-2523?page=comments#action_12421108 ] 
            
Enrique Fernández commented on AXIS-2523:
-----------------------------------------

It happens in 1.3 as well

> WSDL wrong code generation using xs:union
> -----------------------------------------
>
>                 Key: AXIS-2523
>                 URL: http://issues.apache.org/jira/browse/AXIS-2523
>             Project: Apache Axis
>          Issue Type: Bug
>          Components: WSDL processing
>    Affects Versions: 1.4
>         Environment: Windows XP, Java 1.4.2_05, Axis 1.4
>            Reporter: Victor Méndez
>
> Hi, we've found something strange using wsdl2java in AXIS 1.4 which was not happening on 1.3:
> Given next xsd example:
>  	<xs:simpleType name="CommonErrorCodeEnumMPE">
> 		<xs:restriction base="xs:string">
> 			<xs:enumeration value="E-UNKNOWN"/>
> 			<xs:enumeration value="E-COM-UNKNOWN"/>
> 			<xs:enumeration value="E-BADREQUEST"/>
> 			<xs:enumeration value="E-NOSERVICE"/>
> 			<xs:enumeration value="E-BADMATCH"/>
> 			<xs:enumeration value="E-NOMATCH"/>
> 			<xs:enumeration value="E-NOPREVTRX"/>
> 			<xs:enumeration value="E-TIMEOUT"/>
> 			<xs:enumeration value="E-NOMPI"/>
> 			<xs:enumeration value="E-MBLOCK"/>
> 			<xs:enumeration value="E-MSIMBLOCK"/>
> 		</xs:restriction>
> 	</xs:simpleType>
>         <xs:simpleType name="SendRefErrorCodeEnum">
> 		<xs:union memberTypes="CommonErrorCodeEnumMPE">
> 			<xs:simpleType>
> 				<xs:restriction base="xs:string">
> 					<xs:enumeration value="E-SEN-MERNOAVAI"/>
> 					<xs:enumeration value="E-SEN-POSNOAVAI"/>
> 					<xs:enumeration value="E-SEN-INVALREF"/>
> 					<xs:enumeration value="E-SEN-INVAADDATA"/>
> 				</xs:restriction>
> 			</xs:simpleType>
> 		</xs:union>
> 	</xs:simpleType>
> wsdl2Java generates next clases:
>  - CommonErrorCodeEnumMPE.java:...it's OK
>  - SendRefErrorCodeEnum.java:.............Compilation errors: The class SendRefErrorCodeEnum has a "value" String attribute but its accessors have a CommonErrorCodeEnumMPE type
>  - SendRefErrorCodeEnumNull.java: .....What's the meaning of this?
> The source of these classes is:
> /**
>  * CommonErrorCodeEnumMPE.java
>  *
>  * This file was auto-generated from WSDL
>  * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
>  */
> package es.mobipay.xsd;
> public class CommonErrorCodeEnumMPE implements java.io.Serializable {
>     private java.lang.String _value_;
>     private static java.util.HashMap _table_ = new java.util.HashMap();
>     // Constructor
>     protected CommonErrorCodeEnumMPE(java.lang.String value) {
>         _value_ = value;
>         _table_.put(_value_,this);
>     }
>     public static final java.lang.String _value1 = "E-UNKNOWN";
>     public static final java.lang.String _value2 = "E-COM-UNKNOWN";
>     public static final java.lang.String _value3 = "E-BADREQUEST";
>     public static final java.lang.String _value4 = "E-NOSERVICE";
>     public static final java.lang.String _value5 = "E-BADMATCH";
>     public static final java.lang.String _value6 = "E-NOMATCH";
>     public static final java.lang.String _value7 = "E-NOPREVTRX";
>     public static final java.lang.String _value8 = "E-TIMEOUT";
>     public static final java.lang.String _value9 = "E-NOMPI";
>     public static final java.lang.String _value10 = "E-MBLOCK";
>     public static final java.lang.String _value11 = "E-MSIMBLOCK";
>     public static final CommonErrorCodeEnumMPE value1 = new CommonErrorCodeEnumMPE(_value1);
>     public static final CommonErrorCodeEnumMPE value2 = new CommonErrorCodeEnumMPE(_value2);
>     public static final CommonErrorCodeEnumMPE value3 = new CommonErrorCodeEnumMPE(_value3);
>     public static final CommonErrorCodeEnumMPE value4 = new CommonErrorCodeEnumMPE(_value4);
>     public static final CommonErrorCodeEnumMPE value5 = new CommonErrorCodeEnumMPE(_value5);
>     public static final CommonErrorCodeEnumMPE value6 = new CommonErrorCodeEnumMPE(_value6);
>     public static final CommonErrorCodeEnumMPE value7 = new CommonErrorCodeEnumMPE(_value7);
>     public static final CommonErrorCodeEnumMPE value8 = new CommonErrorCodeEnumMPE(_value8);
>     public static final CommonErrorCodeEnumMPE value9 = new CommonErrorCodeEnumMPE(_value9);
>     public static final CommonErrorCodeEnumMPE value10 = new CommonErrorCodeEnumMPE(_value10);
>     public static final CommonErrorCodeEnumMPE value11 = new CommonErrorCodeEnumMPE(_value11);
>     public java.lang.String getValue() { return _value_;}
>     public static CommonErrorCodeEnumMPE fromValue(java.lang.String value)
>           throws java.lang.IllegalArgumentException {
>         CommonErrorCodeEnumMPE enumeration = (CommonErrorCodeEnumMPE)
>             _table_.get(value);
>         if (enumeration==null) throw new java.lang.IllegalArgumentException();
>         return enumeration;
>     }
>     public static CommonErrorCodeEnumMPE fromString(java.lang.String value)
>           throws java.lang.IllegalArgumentException {
>         return fromValue(value);
>     }
>     public boolean equals(java.lang.Object obj) {return (obj == this);}
>     public int hashCode() { return toString().hashCode();}
>     public java.lang.String toString() { return _value_;}
>     public java.lang.Object readResolve() throws java.io.ObjectStreamException { return fromValue(_value_);}
>     public static org.apache.axis.encoding.Serializer getSerializer(
>            java.lang.String mechType, 
>            java.lang.Class _javaType,  
>            javax.xml.namespace.QName _xmlType) {
>         return 
>           new org.apache.axis.encoding.ser.EnumSerializer(
>             _javaType, _xmlType);
>     }
>     public static org.apache.axis.encoding.Deserializer getDeserializer(
>            java.lang.String mechType, 
>            java.lang.Class _javaType,  
>            javax.xml.namespace.QName _xmlType) {
>         return 
>           new org.apache.axis.encoding.ser.EnumDeserializer(
>             _javaType, _xmlType);
>     }
>     // Type metadata
>     private static org.apache.axis.description.TypeDesc typeDesc =
>         new org.apache.axis.description.TypeDesc(CommonErrorCodeEnumMPE.class);
>     static {
>         typeDesc.setXmlType(new javax.xml.namespace.QName("urn:xsd.mobipay.es", "CommonErrorCodeEnumMPE"));
>     }
>     /**
>      * Return type metadata object
>      */
>     public static org.apache.axis.description.TypeDesc getTypeDesc() {
>         return typeDesc;
>     }
> }
> /**
>  * SendRefErrorCodeEnum.java
>  *
>  * This file was auto-generated from WSDL
>  * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
>  */
> package es.mobipay.xsd;
> public class SendRefErrorCodeEnum  extends es.mobipay.xsd.CommonErrorCodeEnumMPE  implements java.io.Serializable {
>     private es.mobipay.xsd.CommonErrorCodeEnumMPE value;
>     // Simple Types must have a String constructor
>     public SendRefErrorCodeEnum(java.lang.String _value) {
>         super(_value);
>     }
>     /**
>      * Gets the value value for this SendRefErrorCodeEnum.
>      * 
>      * @return value
>      */
>     public es.mobipay.xsd.CommonErrorCodeEnumMPE getValue() {
>         return value;
>     }
>     /**
>      * Sets the value value for this SendRefErrorCodeEnum.
>      * 
>      * @param value
>      */
>     public void setValue(es.mobipay.xsd.CommonErrorCodeEnumMPE value) {
>         this.value = value;
>     }
>     private java.lang.Object __equalsCalc = null;
>     public synchronized boolean equals(java.lang.Object obj) {
>         if (!(obj instanceof SendRefErrorCodeEnum)) return false;
>         SendRefErrorCodeEnum other = (SendRefErrorCodeEnum) obj;
>         if (obj == null) return false;
>         if (this == obj) return true;
>         if (__equalsCalc != null) {
>             return (__equalsCalc == obj);
>         }
>         __equalsCalc = obj;
>         boolean _equals;
>         _equals = super.equals(obj) && 
>             ((this.value==null && other.getValue()==null) || 
>              (this.value!=null &&
>               this.value.equals(other.getValue())));
>         __equalsCalc = null;
>         return _equals;
>     }
>     private boolean __hashCodeCalc = false;
>     public synchronized int hashCode() {
>         if (__hashCodeCalc) {
>             return 0;
>         }
>         __hashCodeCalc = true;
>         int _hashCode = 1;
>         if (getValue() != null) {
>             _hashCode += getValue().hashCode();
>         }
>         __hashCodeCalc = false;
>         return _hashCode;
>     }
>     // Type metadata
>     private static org.apache.axis.description.TypeDesc typeDesc =
>         new org.apache.axis.description.TypeDesc(SendRefErrorCodeEnum.class, true);
>     static {
>         typeDesc.setXmlType(new javax.xml.namespace.QName("urn:xsd.mobipay.es", "SendRefErrorCodeEnum"));
>         org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
>         elemField.setFieldName("value");
>         elemField.setXmlName(new javax.xml.namespace.QName("", "value"));
>         elemField.setXmlType(new javax.xml.namespace.QName("urn:xsd.mobipay.es", "CommonErrorCodeEnumMPE"));
>         elemField.setNillable(false);
>         typeDesc.addFieldDesc(elemField);
>     }
>     /**
>      * Return type metadata object
>      */
>     public static org.apache.axis.description.TypeDesc getTypeDesc() {
>         return typeDesc;
>     }
>     /**
>      * Get Custom Serializer
>      */
>     public static org.apache.axis.encoding.Serializer getSerializer(
>            java.lang.String mechType, 
>            java.lang.Class _javaType,  
>            javax.xml.namespace.QName _xmlType) {
>         return 
>           new  org.apache.axis.encoding.ser.SimpleSerializer(
>             _javaType, _xmlType, typeDesc);
>     }
>     /**
>      * Get Custom Deserializer
>      */
>     public static org.apache.axis.encoding.Deserializer getDeserializer(
>            java.lang.String mechType, 
>            java.lang.Class _javaType,  
>            javax.xml.namespace.QName _xmlType) {
>         return 
>           new  org.apache.axis.encoding.ser.SimpleDeserializer(
>             _javaType, _xmlType, typeDesc);
>     }
> }
> /**
>  * SendRefErrorCodeEnumNull.java
>  *
>  * This file was auto-generated from WSDL
>  * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
>  */
> package es.mobipay.xsd;
> public class SendRefErrorCodeEnumNull implements java.io.Serializable {
>     private java.lang.String _value_;
>     private static java.util.HashMap _table_ = new java.util.HashMap();
>     // Constructor
>     protected SendRefErrorCodeEnumNull(java.lang.String value) {
>         _value_ = value;
>         _table_.put(_value_,this);
>     }
>     public static final java.lang.String _value1 = "E-SEN-MERNOAVAI";
>     public static final java.lang.String _value2 = "E-SEN-POSNOAVAI";
>     public static final java.lang.String _value3 = "E-SEN-INVALREF";
>     public static final java.lang.String _value4 = "E-SEN-INVAADDATA";
>     public static final SendRefErrorCodeEnumNull value1 = new SendRefErrorCodeEnumNull(_value1);
>     public static final SendRefErrorCodeEnumNull value2 = new SendRefErrorCodeEnumNull(_value2);
>     public static final SendRefErrorCodeEnumNull value3 = new SendRefErrorCodeEnumNull(_value3);
>     public static final SendRefErrorCodeEnumNull value4 = new SendRefErrorCodeEnumNull(_value4);
>     public java.lang.String getValue() { return _value_;}
>     public static SendRefErrorCodeEnumNull fromValue(java.lang.String value)
>           throws java.lang.IllegalArgumentException {
>         SendRefErrorCodeEnumNull enumeration = (SendRefErrorCodeEnumNull)
>             _table_.get(value);
>         if (enumeration==null) throw new java.lang.IllegalArgumentException();
>         return enumeration;
>     }
>     public static SendRefErrorCodeEnumNull fromString(java.lang.String value)
>           throws java.lang.IllegalArgumentException {
>         return fromValue(value);
>     }
>     public boolean equals(java.lang.Object obj) {return (obj == this);}
>     public int hashCode() { return toString().hashCode();}
>     public java.lang.String toString() { return _value_;}
>     public java.lang.Object readResolve() throws java.io.ObjectStreamException { return fromValue(_value_);}
>     public static org.apache.axis.encoding.Serializer getSerializer(
>            java.lang.String mechType, 
>            java.lang.Class _javaType,  
>            javax.xml.namespace.QName _xmlType) {
>         return 
>           new org.apache.axis.encoding.ser.EnumSerializer(
>             _javaType, _xmlType);
>     }
>     public static org.apache.axis.encoding.Deserializer getDeserializer(
>            java.lang.String mechType, 
>            java.lang.Class _javaType,  
>            javax.xml.namespace.QName _xmlType) {
>         return 
>           new org.apache.axis.encoding.ser.EnumDeserializer(
>             _javaType, _xmlType);
>     }
>     // Type metadata
>     private static org.apache.axis.description.TypeDesc typeDesc =
>         new org.apache.axis.description.TypeDesc(SendRefErrorCodeEnumNull.class);
>     static {
>         typeDesc.setXmlType(new javax.xml.namespace.QName("urn:xsd.mobipay.es", "SendRefErrorCodeEnum>null"));
>     }
>     /**
>      * Return type metadata object
>      */
>     public static org.apache.axis.description.TypeDesc getTypeDesc() {
>         return typeDesc;
>     }
> }
> Apparently, this same xsd creates other (but right) classes if generated with AXIS 1.3 wsdl2java tool, so it seems to be somethig specific of 1.4 version
>  

-- 
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

       

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