axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wes Munsil" <mun...@alumni.caltech.edu>
Subject WSDL2Java arrays--bug?
Date Fri, 27 Jan 2006 16:14:23 GMT
Hello -

I am following the advice at http://ws.apache.org/axis/bugs.html: “If
you're not sure whether the behavior in question is a bug or a feature,
please post a message to the axis-dev mailing list for clarification.”

I’ve already posted to axis-user and done lots of web searching (including
JIRA), with no luck. This seems to be a problem in at least Axis 1.1
through 1.3. Or else there’s something wrong in the WSDL. I’ll enter a bug
report unless anyone here has serious objection.

The apparent problem is that WSDL2Java generates a call of setXmlType
specifying the array component type rather than the array type. A short
1.3 example follows, where the array component type is “int” and the array
type is “ArrayOfint”. (I observe it with complex component types as well.)

Thanks in advance for your consideration.

Wes Munsil

INPUT TO WSDL2JAVA

<?xml version="1.0"?>
<definitions targetNamespace="urn:top"
   xmlns:tns="urn:top"
   xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
   xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
   xmlns:xsd4="urn:top"
   xmlns:xsd="http://www.w3.org/2001/XMLSchema"
   xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
   xmlns="http://schemas.xmlsoap.org/wsdl/">

   <types>
      <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:top">
         <xsd:complexType name="ArrayOfint">
            <xsd:complexContent>
               <xsd:restriction base="SOAP-ENC:Array">
                  <xsd:attribute ref="SOAP-ENC:arrayType"
wsdl:arrayType="xsd:int[]"/>
               </xsd:restriction>
            </xsd:complexContent>
         </xsd:complexType>
         <xsd:complexType name="Context">
            <xsd:sequence>
               <xsd:element name="ErrorCode" type="tns:ArrayOfint"/>
            </xsd:sequence>
         </xsd:complexType>
      </xsd:schema>
   </types>

   <message name="fetchComponentNamesRequest">
      <part name="in1" type="tns:Context" />
   </message>

   <message name="fetchComponentNamesResponse">
      <part name="result" type="xsd:int" />
   </message>

   <portType name="topPortType">
      <operation name="fetchComponentNames">
         <input message="tns:fetchComponentNamesRequest" />
         <output message="tns:fetchComponentNamesResponse" />
      </operation>
   </portType>

   <binding name="topBinding" type="tns:topPortType">
      <soap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http" />
      <operation name="fetchComponentNames">
         <soap:operation soapAction="" />
         <input>
            <soap:body namespace="urn:top"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
use="encoded" />
         </input>
         <output>
            <soap:body namespace="urn:top"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
use="encoded" />
         </output>
      </operation>
   </binding>

   <service name="top">
      <documentation>Spheon JSOAP</documentation>
      <port name="topPort" binding="tns:topBinding">
         <soap:address location="http://localhost:8888/ws/topology" />
      </port>
   </service>
</definitions>

OUTPUT FROM WSDL2JAVA

/**
 * Context.java
 *
 * This file was auto-generated from WSDL
 * by the Apache Axis 1.3 Oct 05, 2005 (05:23:37 EDT) WSDL2Java emitter.
 */

package top_pkg;

public class Context  implements java.io.Serializable {
    private int[] errorCode;

    public Context() {
    }

    public Context(
           int[] errorCode) {
           this.errorCode = errorCode;
    }


    /**
     * Gets the errorCode value for this Context.
     *
     * @return errorCode
     */
    public int[] getErrorCode() {
        return errorCode;
    }


    /**
     * Sets the errorCode value for this Context.
     *
     * @param errorCode
     */
    public void setErrorCode(int[] errorCode) {
        this.errorCode = errorCode;
    }

    private java.lang.Object __equalsCalc = null;
    public synchronized boolean equals(java.lang.Object obj) {
        if (!(obj instanceof Context)) return false;
        Context other = (Context) obj;
        if (obj == null) return false;
        if (this == obj) return true;
        if (__equalsCalc != null) {
            return (__equalsCalc == obj);
        }
        __equalsCalc = obj;
        boolean _equals;
        _equals = true &&
            ((this.errorCode==null && other.getErrorCode()==null) ||
             (this.errorCode!=null &&
              java.util.Arrays.equals(this.errorCode,
other.getErrorCode())));
        __equalsCalc = null;
        return _equals;
    }

    private boolean __hashCodeCalc = false;
    public synchronized int hashCode() {
        if (__hashCodeCalc) {
            return 0;
        }
        __hashCodeCalc = true;
        int _hashCode = 1;
        if (getErrorCode() != null) {
            for (int i=0;
                 i<java.lang.reflect.Array.getLength(getErrorCode());
                 i++) {
                java.lang.Object obj =
java.lang.reflect.Array.get(getErrorCode(), i);
                if (obj != null &&
                    !obj.getClass().isArray()) {
                    _hashCode += obj.hashCode();
                }
            }
        }
        __hashCodeCalc = false;
        return _hashCode;
    }

    // Type metadata
    private static org.apache.axis.description.TypeDesc typeDesc =
        new org.apache.axis.description.TypeDesc(Context.class, true);

    static {
        typeDesc.setXmlType(new javax.xml.namespace.QName("urn:top",
"Context"));
        org.apache.axis.description.ElementDesc elemField = new
org.apache.axis.description.ElementDesc();
        elemField.setFieldName("errorCode");
        elemField.setXmlName(new javax.xml.namespace.QName("", "ErrorCode"));
        elemField.setXmlType(new
javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema",
"int"));
        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.BeanSerializer(
            _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.BeanDeserializer(
            _javaType, _xmlType, typeDesc);
    }

}

Mime
View raw message