Please could an Axis developer confirm and then register this bug in Jira for
me - I couldn't find a known bug that seemed to be the same.
Axis 1.4 - WSDL2Java generates a DistanceType.java source file, from the
following schema, with compile errors (the float member and supporting
methods are not created).
<xs:complexType name="DistanceType">
<xs:simpleContent>
<xs:extension base="DistanceValueType">
<xs:attribute name="Unit" type="DistanceUnitType" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="DistanceValueType">
<xs:restriction base="xs:float">
<xs:minInclusive value="0"/><xs:maxInclusive value="255"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="DistanceUnitType">
<xs:restriction base="xs:string">
<xs:enumeration value="Km"/>
<xs:enumeration value="Mi"/>
</xs:restriction>
</xs:simpleType>
On the other hand Axis 1.2.1 - WSDL2Java creates the DistanceType.java
correctly.
If I replace DistanceType.java generated by Axis 1.4 with the one generated by
Axis1.2.1 then the 1.4 generated code compiles OK.
This wsdl to generate this error can be found at:
http://gw.bedsearcher.co.uk/axis2/services/BsTestWebService?wsdl
The two DistanceType.java files are attached.
Many thanks,
Pete.H.
/**
* DistanceType.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.2.1 Jun 14, 2005 (09:15:57 EDT) WSDL2Java emitter.
*/
package uk.co.bedsearcher.www.Bs._2007._01;
public class DistanceType implements java.io.Serializable, org.apache.axis.encoding.SimpleType {
private float _value;
private uk.co.bedsearcher.www.Bs._2007._01.DistanceUnitType unit; // attribute
public DistanceType() {
}
// Simple Types must have a String constructor
public DistanceType(float _value) {
this._value = _value;
}
public DistanceType(java.lang.String _value) {
this._value = new Float(_value).floatValue();
}
// Simple Types must have a toString for serializing the value
public java.lang.String toString() {
return new Float(_value).toString();
}
/**
* Gets the _value value for this DistanceType.
*
* @return _value
*/
public float get_value() {
return _value;
}
/**
* Sets the _value value for this DistanceType.
*
* @param _value
*/
public void set_value(float _value) {
this._value = _value;
}
/**
* Gets the unit value for this DistanceType.
*
* @return unit
*/
public uk.co.bedsearcher.www.Bs._2007._01.DistanceUnitType getUnit() {
return unit;
}
/**
* Sets the unit value for this DistanceType.
*
* @param unit
*/
public void setUnit(uk.co.bedsearcher.www.Bs._2007._01.DistanceUnitType unit) {
this.unit = unit;
}
private java.lang.Object __equalsCalc = null;
public synchronized boolean equals(java.lang.Object obj) {
if (!(obj instanceof DistanceType)) return false;
DistanceType other = (DistanceType) obj;
if (obj == null) return false;
if (this == obj) return true;
if (__equalsCalc != null) {
return (__equalsCalc == obj);
}
__equalsCalc = obj;
boolean _equals;
_equals = true &&
this._value == other.get_value() &&
((this.unit==null && other.getUnit()==null) ||
(this.unit!=null &&
this.unit.equals(other.getUnit())));
__equalsCalc = null;
return _equals;
}
private boolean __hashCodeCalc = false;
public synchronized int hashCode() {
if (__hashCodeCalc) {
return 0;
}
__hashCodeCalc = true;
int _hashCode = 1;
_hashCode += new Float(get_value()).hashCode();
if (getUnit() != null) {
_hashCode += getUnit().hashCode();
}
__hashCodeCalc = false;
return _hashCode;
}
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(DistanceType.class, true);
static {
typeDesc.setXmlType(new javax.xml.namespace.QName("http://www.bedsearcher.co.uk/Bs/2007/01", "DistanceType"));
org.apache.axis.description.AttributeDesc attrField = new org.apache.axis.description.AttributeDesc();
attrField.setFieldName("unit");
attrField.setXmlName(new javax.xml.namespace.QName("", "Unit"));
attrField.setXmlType(new javax.xml.namespace.QName("http://www.bedsearcher.co.uk/Bs/2007/01", "DistanceUnitType"));
typeDesc.addFieldDesc(attrField);
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("http://www.bedsearcher.co.uk/Bs/2007/01", "DistanceValueType"));
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);
}
}
/**
* DistanceType.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package uk.co.bedsearcher.www.Bs._2007._01;
public class DistanceType implements java.io.Serializable, org.apache.axis.encoding.SimpleType {
private uk.co.bedsearcher.www.Bs._2007._01.DistanceUnitType unit; // attribute
public DistanceType() {
}
// Simple Types must have a String constructor
public DistanceType(float _value) {
super(_value);
}
/**
* Gets the unit value for this DistanceType.
*
* @return unit
*/
public uk.co.bedsearcher.www.Bs._2007._01.DistanceUnitType getUnit() {
return unit;
}
/**
* Sets the unit value for this DistanceType.
*
* @param unit
*/
public void setUnit(uk.co.bedsearcher.www.Bs._2007._01.DistanceUnitType unit) {
this.unit = unit;
}
private java.lang.Object __equalsCalc = null;
public synchronized boolean equals(java.lang.Object obj) {
if (!(obj instanceof DistanceType)) return false;
DistanceType other = (DistanceType) 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.unit==null && other.getUnit()==null) ||
(this.unit!=null &&
this.unit.equals(other.getUnit())));
__equalsCalc = null;
return _equals;
}
private boolean __hashCodeCalc = false;
public synchronized int hashCode() {
if (__hashCodeCalc) {
return 0;
}
__hashCodeCalc = true;
int _hashCode = 1;
if (getUnit() != null) {
_hashCode += getUnit().hashCode();
}
__hashCodeCalc = false;
return _hashCode;
}
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(DistanceType.class, true);
static {
typeDesc.setXmlType(new javax.xml.namespace.QName("http://www.bedsearcher.co.uk/Bs/2007/01", "DistanceType"));
org.apache.axis.description.AttributeDesc attrField = new org.apache.axis.description.AttributeDesc();
attrField.setFieldName("unit");
attrField.setXmlName(new javax.xml.namespace.QName("", "Unit"));
attrField.setXmlType(new javax.xml.namespace.QName("http://www.bedsearcher.co.uk/Bs/2007/01", "DistanceUnitType"));
typeDesc.addFieldDesc(attrField);
}
/**
* 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);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]