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 bu...@apache.org on 2003/04/16 16:40:09 UTC
DO NOT REPLY [Bug 19069] New: -
WSDL2Java generates code with does not compile
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19069>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19069
WSDL2Java generates code with does not compile
Summary: WSDL2Java generates code with does not compile
Product: Axis
Version: current (nightly)
Platform: All
OS/Version: All
Status: NEW
Severity: Major
Priority: Other
Component: WSDL processing
AssignedTo: axis-dev@ws.apache.org
ReportedBy: Oliver.Adler@syracom.de
A type based on a enumeration which contains values of the type
normalizedString causes WSDL2Java
to generate invalid code.
Here is the definition as extract of two schemas:
Schema1 includes Schema2
Schema1:
...
<xsd:complexType name="berufschluessel">
<xsd:simpleContent>
<xsd:extension base="geno:berufschluesselEnum">
<xsd:attribute name="Auspraegung" use="optional">
<xsd:simpleType>
<xsd:restriction
base="xsd:normalizedString">
<xsd:maxLength value="2"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
...
Schema2:
...
<xsd:simpleType name="berufschluesselEnum">
<xsd:restriction base="xsd:normalizedString">
<xsd:enumeration value="Arbeiter"/>
<xsd:enumeration value="Angestellter"/>
<xsd:enumeration value="RentnerPensionaer"/>
<xsd:enumeration value="SchuelerStudent"/>
<xsd:enumeration value="KeineAngabe"/>
</xsd:restriction>
</xsd:simpleType>
...
This causes WSDL2Java to generate the following code:
File1:
========
/**
* Berufschluessel.java
*
* This file was auto-generated from WSDL
* by the Apache Axis WSDL2Java emitter.
*/
package com.acme.www.services.types;
public class Berufschluessel implements java.io.Serializable,
org.apache.axis.encoding.SimpleType {
private de.geno.www.services.genotypes.BerufschluesselEnum value;
private de.geno.www.services.genotypes.Berufschluessel_Auspraegung
auspraegung; // attribute
public Berufschluessel() {
}
public Berufschluessel(de.geno.www.services.genotypes.BerufschluesselEnum
value) {
this.value = value;
}
// Simple Types must have a String constructor
public Berufschluessel(java.lang.String value) {
this.value = new de.geno.www.services.genotypes.BerufschluesselEnum
(value);
}
// Simple Types must have a toString for serializing the value
public java.lang.String toString() {
return value == null ? null : value.toString();
}
public de.geno.www.services.genotypes.BerufschluesselEnum getValue() {
return value;
}
public void setValue(de.geno.www.services.genotypes.BerufschluesselEnum
value) {
this.value = value;
}
public de.geno.www.services.genotypes.Berufschluessel_Auspraegung
getAuspraegung() {
return auspraegung;
}
public void setAuspraegung
(de.geno.www.services.genotypes.Berufschluessel_Auspraegung auspraegung) {
this.auspraegung = auspraegung;
}
private java.lang.Object __equalsCalc = null;
public synchronized boolean equals(java.lang.Object obj) {
if (!(obj instanceof Berufschluessel)) return false;
Berufschluessel other = (Berufschluessel) 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==null && other.getValue()==null) ||
(this.value!=null &&
this.value.equals(other.getValue()))) &&
((this.auspraegung==null && other.getAuspraegung()==null) ||
(this.auspraegung!=null &&
this.auspraegung.equals(other.getAuspraegung())));
__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();
}
if (getAuspraegung() != null) {
_hashCode += getAuspraegung().hashCode();
}
__hashCodeCalc = false;
return _hashCode;
}
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(Berufschluessel.class);
static {
typeDesc.setXmlType(new javax.xml.namespace.QName
("http://www.geno.de/services/genotypes", "berufschluessel"));
org.apache.axis.description.AttributeDesc attrField = new
org.apache.axis.description.AttributeDesc();
attrField.setFieldName("auspraegung");
attrField.setXmlName(new javax.xml.namespace.QName("", "Auspraegung"));
attrField.setXmlType(new javax.xml.namespace.QName
("http://www.geno.de/services/genotypes", "berufschluessel>Auspraegung"));
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.geno.de/services/genotypes", "berufschluesselEnum"));
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);
}
}
File2:
========
/**
* BerufschluesselEnum.java
*
* This file was auto-generated from WSDL
* by the Apache Axis WSDL2Java emitter.
*/
package com.acme.www.services.types;
public class BerufschluesselEnum implements java.io.Serializable {
private org.apache.axis.types.NormalizedString _value_;
private static java.util.HashMap _table_ = new java.util.HashMap();
// Constructor
protected BerufschluesselEnum(org.apache.axis.types.NormalizedString value)
{
_value_ = value;
_table_.put(_value_,this);
}
public static final org.apache.axis.types.NormalizedString _Arbeiter = new
org.apache.axis.types.NormalizedString("Arbeiter");
public static final org.apache.axis.types.NormalizedString _Angestellter =
new org.apache.axis.types.NormalizedString("Angestellter");
public static final org.apache.axis.types.NormalizedString
_RentnerPensionaer = new org.apache.axis.types.NormalizedString
("RentnerPensionaer");
public static final org.apache.axis.types.NormalizedString _SchuelerStudent
= new org.apache.axis.types.NormalizedString("SchuelerStudent");
public static final BerufschluesselEnum KeineAngabe = new
BerufschluesselEnum(_KeineAngabe);
public org.apache.axis.types.NormalizedString getValue() { return _value_;}
public static BerufschluesselEnum fromValue
(org.apache.axis.types.NormalizedString value)
throws java.lang.IllegalStateException {
BerufschluesselEnum enum = (BerufschluesselEnum)
_table_.get(value);
if (enum==null) throw new java.lang.IllegalStateException();
return enum;
}
public static BerufschluesselEnum fromString(java.lang.String value)
throws java.lang.IllegalStateException {
try {
return fromValue(new org.apache.axis.types.NormalizedString(value));
} catch (Exception e) {
throw new java.lang.IllegalStateException();
}
}
public boolean equals(java.lang.Object obj) {return (obj == this);}
public int hashCode() { return toString().hashCode();}
public java.lang.String toString() { return _value_.toString();}
public java.lang.Object readResolve() throws java.io.ObjectStreamException
{ return fromValue(_value_);}
}
The compile error occurs at:
// Simple Types must have a String constructor
public Berufschluessel(java.lang.String value) {
this.value = new de.geno.www.services.genotypes.BerufschluesselEnum
(value);
}