You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by jagannath <ja...@adventnet.com> on 2004/04/09 11:16:16 UTC

problems retrieving the value of ArrayList of Object Array

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

Datahandler within a Bean?

Posted by Gareth Western <p2...@garethwestern.com>.
Hi,
If one puts a variable of type DataHandler within a Bean, would that 
DataHandler still be added as an attachment to the resulting SOAP message?
Ta,
Gareth