Nuts, I was lazy and just did a reply-to the last question, and forgot to
paste the old subject line,
anyways, I have a shot at cleaning up the snipit (our mail gateway
apparently auto-breaks)
<snipit>
QName qn = new QName( "urn:MyWebService", "ValueObject" );
call.registerTypeMapping(ArrayList.class, XMLType.SOAP_ARRAY, new
ArraySerializerFactory(), new ArrayDeserializerFactory());
call.registerTypeMapping(ValueObject.class, qn, new
BeanSerializerFactory(ValueObject.class, qn), new
BeanDeserializerFactory(ValueObject.class, qn));
call.addParameter( "arg0", XMLType.XSD_LONG, ParameterMode.IN);
call.setReturnType(XMLType.SOAP_ARRAY);
ArrayList results = (ArrayList)call.invoke(new Object[] {aLongValue});
</snipit>
[EMAIL PROTECTED] on 09/17/2003 01:55:05 PM
Please respond to [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
cc:
Subject: Re: deploying with a wsdd file
I'm a little late, but I just had that same problem and I wanted to "share
the code" for the mailing list archive:
Note that this is code for the client, the server seems to serialize the
ArrayList correctly (or at least in a manner that the ArrayDeserializer can
parse). I am not sure if it will work the other way, but it should
(damnit).
This code is from a project that responds with an ArrayList() of
ValueObject()s.
import java.util.ArrayList;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.AxisFault;
import org.apache.axis.encoding.ser.*;
import javax.xml.namespace.QName;
import javax.xml.rpc.soap.SOAPFaultException;
import javax.xml.rpc.encoding.XMLType;
import javax.xml.rpc.ParameterMode;
<snipit>
QName qn = new QName( "urn:MyWebService", "ValueObject" );
call.registerTypeMapping(ArrayList.class, XMLType.SOAP_ARRAY, new
ArraySerializerFactory(), new ArrayDeserializerFactory());
call.registerTypeMapping(ValueObject.class, qn, new
BeanSerializerFactory(ValueObject.class, qn), new
BeanDeserializerFactory(ValueObject.class, qn));
call.addParameter( "arg0", XMLType.XSD_LONG, ParameterMode.IN);
call.setReturnType(XMLType.SOAP_ARRAY);
ArrayList results = (ArrayList)call.invoke(new Object[] {aLongValue});
</snipit>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
old messages copied from the mailing list archieve
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Great, I followed the VectorDeserializer example and make it work for my
ArrayList class attribute. There is an undocumented method setChildValue()
which can perform the ArrayList.add() function I was looking for. Thanks
much for the tip.
I hope setChildValue() shows up in the next version of Axis API doc.
Bruce
> -----Original Message-----
> From: Sashith Kumar [mailto:[EMAIL PROTECTED]
> Sent: Saturday, August 30, 2003 2:52 AM
> To: [EMAIL PROTECTED]
> Subject: RE: samples for ArrayList
>
>
> If u are so perticular to write a serializer/Deserializer for ArrayList,
> u can refer the code of vector serailization/deserialization which is
> already supported by AXIS
>
> sash
>
> Sashith k
> Mascot Systems Ltd. Chennai - India.
> & +91-44-230 1236-7-8 X 3328
>
>
> Live And Let Live
>
> > -----Original Message-----
> > From: Bruce Ho [SMTP:[EMAIL PROTECTED]
> > Sent: Saturday, August 30, 2003 5:30 AM
> > To: [EMAIL PROTECTED]
> > Subject: RE: samples for ArrayList
> >
> >
> > I think it is not quite so easy to write a deserializer for the
> ArrayList.
> > The custom Deserializer can only feeding children deserializers (of the
> > Arraylist) back to the DeserializerContext, who seems to be tacking
> child
> > objects onto the Parent Object as class attributes. In case the parent
> is
> > the ArrayList, we need the context to do an ArrayList.add(Object child)
> > instead. Maybe there is a way to subclass the DeserializerContext to
> > override the usu behavior for adding child elements as class
attributes,
> > but
> > I don't see any examples of this.
> >
> > Any ideas?
> >
> > Bruce
> >
> >
> >
> > List: axis-user
> > Subject: RE: samples for ArrayList
> > From: "Cory Wilkerson" <cwilkerson () travelnow ! com>
> > Date: 2003-08-27 18:28:27
> > [Download message RAW]
> >
> > Seeing as how an ArrayList is an ordered set of items, you could easily
> > write a \
> > serializer/deserializer pair to handle passing ArrayLists between
> > services.
> > I'm not \
> > sure if the Axis server side and client side tools already have some
> > deserializer \
> > built in for the list interface -- seems like a good idea if they
don't.
> >
> > The bottom line is, ArrayList won't be serializable/deserializable
> across
> > platforms \
> > w/o some effort on your end to describe it.
> >
> > -----Original Message-----
> > From: Bruce Ho [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, August 27, 2003 1:00 PM
> > To: [EMAIL PROTECTED]
> > Subject: samples for ArrayList
> >
> >
> >
> > Does anyone out there have a working sample for passing an ArrayList
(of
> > user \
> > generated objects) using Axis, including Java code, wsdl, and wsdd?
> >
> > Is it only a myth that an ArrayList can be passed? The numerous
postings
> > in
> > this \
> > group suggest that no one has had any luck with this.
> >
> >
> >
> > Bruce
> >
> >
> >
> DISCLAIMER: Information contained and transmitted by this E-MAIL is
> proprietary to Mascot Systems Limited and is intended for use only by the
> individual or entity to which it is addressed, and may contain
information
> that is privileged, confidential or exempt from disclosure under
> applicable
> law. If this is a forwarded message, the content of this E-MAIL may not
> have
> been sent with the authority of the Company. If you are not the intended
> recipient, an agent of the intended recipient or a person responsible for
> delivering the information to the named recipient, you are notified that
> any
> use, distribution, transmission, printing, copying or dissemination of
> this
> information in any way or in any manner is strictly prohibited. If you
> have
> received this communication in error, please delete this mail & notify us
> immediately at [EMAIL PROTECTED] Before opening attachments,
> please scan for viruses.