Thanks Anne and Mariano, As I am adding Axis functionality to a pre-existing app my value objects can't really be changed without breaking things. So I am stuck with Collection types.
Luckily, I use Castor in my project already so I will simply use the Castor serializers instead - this can easily cope with serializing and deserializing collections of any type. Looks like I will be saying "no" to the Axis serialization mechanisms! Cheers, Patrick -----Original Message----- From: Anne Thomas Manes [mailto:[EMAIL PROTECTED] Sent: 23 February 2005 20:10 To: [email protected] Subject: Re: Problem with serialization of Beans containing Collections and ArrayLists That's right. Stick with arrays. Just say "no" to colllections. - Anne On Wed, 23 Feb 2005 13:55:44 +0100, Mariano Eloy Fern�ndez <[EMAIL PROTECTED]> wrote: > Hello, > > Patrick, an advise from a fool. > Use MyClass[] instead of Vector or Collections, mainly becouse that way > you provide the wrapped type to Axis' De/Serializers. > > Cheers, > > Mariano Eloy Fern�ndez.. > > Patrick van Kann wrote: > > > I have integrated Axis 1.2 RC2 binary with an existing web app. I have > > a simple web service defined in my server-config.wsdd as follows: > > > > <service > > name="TimesheetWebService" > > provider="java:RPC"> > > <parameter name="allowedMethods" value="*"/> > > <parameter name="className" > > value="com.fc.timesheet.webservices.TimesheetWebService"/> > > <beanMapping > > languageSpecificType="java:com.fc.timesheet.data.TestData" > > qname="ns1:Test" xmlns:ns1="urn:data.timesheet.fc.com"/> > > </service> > > > > It has a single method that returns a simple JavaBean of type TestData. > > > > The TestData JavaBean has a member that is a Vector: > > > > private Vector tests = new Vector(); > > > > public Vector getTests() { > > return this.tests; > > } > > > > public void setTests( Vector tests ) { > > this.tests = tests; > > } > > > > If I generate the client and test case using WSDL2Java (based on the > > WSDL that the Axis Servlet produces automatically) the test case runs > > just fine. > > > > However, if I change my TestData class to have a Collection (backed by > > an ArrayList) instead i.e.: > > > > private Collection tests = new ArrayList(); > > > > public Collection getTests() { > > return this.tests; > > } > > > > public void setTests( Collection tests ) { > > this.tests = tests; > > } > > > > I get an error when I try re-deploy to the server and re-generate and > > re-run the client/test case: > > > > "org.xml.sax.SAXException: Found character data inside an array > > element while deserializing" > > > > What do I need to do differently to handle Collections/ArrayLists? > > > > Thanks in advance, > > > > Patrick > > > >
