Plz create a bug report with your full example that we can use to recreate the problem. Make sure you are using at least Axis 1.2 Beta.
thanks, dims --- jagannath <[EMAIL PROTECTED]> wrote: > Guys, > > Any update on this. > > Please help as this is urgent to me. > > Please let me know if any other information is required. > > Regards, > Jagannath > > > Hello Users, > > I am facing problems retrieving the value of ArrayList of Object Array > using client stubs generated using WSDL2Java. The ObjectArray has just a > string in it. > > I have a method in my WebService that returns an java.util.ArrayList of > ObjectArray. For this I have written serializer for ArrayList and > defined the ArrayOfObject in my wsdl file as shown below > > <complexType name="ArrayList"> > <all> > <element name="item" minOccurs="0" maxOccurs="unbounded" > type="xsd:anyType"/> > </all> > </complexType> > > <complexType name="ArrayOfObject"> > <complexContent> > <restriction base="soapenc:Array"> > <attribute ref="soapenc:arrayType" > wsdl:arrayType="xsd:anyType[]"/> > </restriction> > </complexContent> > </complexType> > > The ArrayList.java that is generated is attached with this mail. > > What is happening is I only get the String present in the last > ObjectArray added in the ArrayList. When I have a ArrayList that > contains String I am able to fetch all the values. > > For further reference please refer the tcpmon response for ArrayList of > String and ArrayList of ObjectArray below > > ----------ArrayList with ObjectArray--------------- > > <?xml version="1.0" encoding="UTF-8"?> > <soapenv:Envelope > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" > xmlns:xsd="http://www.w3.org/2001/XMLSchema" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> > <soapenv:Body> > <ns1:invokeResponse > soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" > xmlns:ns1="http://localhost:7001/jmx/soapServices/AdventNetSoapAgent"> > <invokeReturn href="#id0"/> > </ns1:invokeResponse> > <multiRef id="id0" soapenc:root="0" > soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" > xsi:type="ns2:ArrayList" > xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" > xmlns:ns2="urn:AdventNetSoapAgentTypes"> > <item xsi:type="ns2:ArrayOfObject"> > <item xsi:type="xsd:string">33333333</item> > </item> > <item xsi:type="ns2:ArrayOfObject"> > <item xsi:type="xsd:string">222222222</item> > </item> > <item xsi:type="ns2:ArrayOfObject"> > <item xsi:type="xsd:string">334444444</item> > </item> > </multiRef> > </soapenv:Body> > </soapenv:Envelope> > > ----------ArrayList with ObjectArray--------------- > > ----------ArrayList with String--------------- > > <?xml version="1.0" encoding="UTF-8"?> > <soapenv:Envelope > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" > xmlns:xsd="http://www.w3.org/2001/XMLSchema" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> > <soapenv:Body> > <ns1:invokeResponse > soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" > xmlns:ns1="http://localhost:7001/jmx/soapServices/AdventNetSoapAgent"> > <invokeReturn href="#id0"/> > </ns1:invokeResponse> > <multiRef id="id0" soapenc:root="0" > soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" > xsi:type="ns2:ArrayList" > xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" > xmlns:ns2="urn:AdventNetSoapAgentTypes"> > <item xsi:type="xsd:string">33333333</item> > <item xsi:type="xsd:string">222222222</item> > <item xsi:type="xsd:string">334444444</item> > </multiRef> > </soapenv:Body> > </soapenv:Envelope> > > ----------ArrayList with String--------------- > > I tried some debugging by putting print statements in the /setItem/ > method of ArrayList stub. > > I found that for ArrayList with three Strings the method gets called > three times with the Object[] passed having 1,2 and 3 elements it. That > is in the third call the Object[] passed has all the 3 Strings in it. > > But for ArrayList with Object[] in it, though the setItem method gets > called three times the Object[] passed has only one element in it. So > only the last element gets stored in the ArrayList stub. > > Hope I am clear. > > I am using AXIS1.0 version. > > Is this an issue with AXIS or am I missing something. > > Please help as this is urgent to me. > > Thanks, > > -- > ------------------------------------------------------- > Jagannath.C > AdventNet ManageEngine JMX Studio > Off : 2243115 Extn:5252 > Nortel: +91-925-895-6380 > www.adventnet.com > ------------------------------------------------------- > > /** > * ArrayList.java > * > * This file was auto-generated from WSDL > * by the Apache Axis WSDL2Java emitter. > */ > > package AdventNetSoapAgentTypes; > > public class ArrayList implements java.io.Serializable { > private java.lang.Object[] item; > > public ArrayList() { > } > > public java.lang.Object[] getItem() { > return item; > } > > public void setItem(java.lang.Object[] item) { > System.out.println("ArrayList: Inside setItem "+item.length); > this.item = item; > } > > public java.lang.Object getItem(int i) { > return item[i]; > } > > public void setItem(int i, java.lang.Object value) { > this.item[i] = value; > } > > private java.lang.Object __equalsCalc = null; > public synchronized boolean equals(java.lang.Object obj) { > if (!(obj instanceof ArrayList)) return false; > ArrayList other = (ArrayList) obj; > if (obj == null) return false; > if (this == obj) return true; > if (__equalsCalc != null) { > return (__equalsCalc == obj); > } > __equalsCalc = obj; > boolean _equals; > _equals = true && > ((item==null && other.getItem()==null) || > (item!=null && > java.util.Arrays.equals(item, other.getItem()))); > __equalsCalc = null; > return _equals; > } > > private boolean __hashCodeCalc = false; > public synchronized int hashCode() { > if (__hashCodeCalc) { > return 0; > } > __hashCodeCalc = true; > int _hashCode = 1; > if (getItem() != null) { > for (int i=0; > i<java.lang.reflect.Array.getLength(getItem()); > i++) { > java.lang.Object obj = java.lang.reflect.Array.get(getItem(), 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(ArrayList.class); > > static { > org.apache.axis.description.FieldDesc field = new > org.apache.axis.description.ElementDesc(); > field.setFieldName("item"); > field.setXmlName(new javax.xml.namespace.QName("", "item")); > field.setMinOccursIs0(true); > typeDesc.addFieldDesc(field); > }; > > /** > * 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); > } > > } > > ===== Davanum Srinivas - http://webservices.apache.org/~dims/
