On the client all I do is register the serializer for my object.

    // prepare the mapping registry
    registry = new SOAPMappingRegistry();
    //QName qname = new QName("http://www.stringservice/xsd";, "StringBean");
    QName qname = new
QName("http://www.themindelectric.com/package/service.common/";,
"StringBean");
     
    BeanSerializer serializer = new BeanSerializer();
    registry.mapTypes(Constants.NS_URI_SOAP_ENC, qname, StringBean.class,
serializer, serializer);

> -----Original Message-----
> From: Andrew Simpson [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 09, 2002 4:30 PM
> To: [EMAIL PROTECTED]
> Subject: RE: Serializing an array of beans
> 
> 
> 
> Hi Richard, thanks for your message.
> 
> I should have clarified that I'm currently only interested in 
> server->client
> communication, i.e. the java2XMLClassName attribute; your 
> examples seem to
> be for client->server.
> 
> What I'd like to be able to do is something like:
> 
> <isd:map
>   encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
>   xmlns:x="soapejb" qname="x:StockBean[]"
>   Java2XMLClassName="org.apache.soap.encoding.soapenc.BeanSerializer"
> />
> 
> OR maybe a combination of
> 
> <isd:map
>   encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
>   xmlns:x="soapejb" qname="x:StockBean"
>   Java2XMLClassName="org.apache.soap.encoding.soapenc.BeanSerializer"
> />
> <isd:map
>   encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
>   xmlns:x="soapejb" qname="x:StockBean[]"
>   Java2XMLClassName="org.apache.soap.encoding.soapenc.ArraySerializer"
> />
> 
> And have the invoked method look like:
> 
> StockBean[] listStocks { //... }
> 
> 
> However I've concluded that neither of these is possible, and 
> that I will
> need to write and serialize a wrapper class myself (i.e. a 
> simple bean that
> contains an array, rather than an array).
> 
> I can't make ANY type of serializer other than the apache 
> ones work, which
> worries me.
> 
> I assume that providing a class and a pointer to it is all 
> that I need to do
> at the server end?
> 
> Thanks,
> 
> Andrew
> 
> -----Original Message-----
> From: Hansen, Richard [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 09, 2002 5:01 PM
> To: '[EMAIL PROTECTED]'
> Subject: RE: Serializing an array of beans
> 
> 
> I don't think you normally need to worry about array 
> serialization. I think
> it will just happen. You do need to worry about serializing 
> your bean. But
> if the bean class is properly registered with a serializer 
> arrays should
> just work. The only reason I needed to register the arrays 
> was so MS SOAP
> would work. In my Java client I just registered a serializer 
> for my bean.
> 
>     <isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
>              xmlns:x="" qname="x:stringArray"
> 
> xml2JavaClassName="org.apache.soap.encoding.soapenc.ArraySerializer"/>
> 
>     <isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
>              xmlns:x="" qname="x:stringBeanArray"
> 
> xml2JavaClassName="org.apache.soap.encoding.soapenc.ArraySerializer"/>
> 
> > -----Original Message-----
> > From: Andrew Simpson [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, January 09, 2002 3:52 PM
> > To: [EMAIL PROTECTED]
> > Subject: Serializing an array of beans
> >
> >
> > Hi, I'm going round in circles trying to serialize an array 
> of beans.
> >
> > First I tried using the Apache Bean Serializer, specifying it in the
> > deployment descriptor; this worked for one bean, but not 
> for an array.
> >
> > I then wrapped the array in another class, then tried to 
> write my own
> > serializer for the wrapper class, and refer to this 
> serializer in the
> > deployment descriptor.
> >
> > This produces an error on post whenever I change it to point
> > from anything
> > but the apache serializers.
> >
> > I am inspecting the XML returned from the soap servlet, the
> > output is shown
> > below.
> >
> > On the server end, is using the deployment descriptor (e.g.
> > xml2java...
> > attribute) sufficent to successfully invoke my serializer
> > when returning a
> > reply?
> >
> > From the client end I am using perl SOAP::Lite to invoke the
> > function.  On
> > the server end I am using the StatelessSessionBean provider
> > to invoke a
> > method whose return type is the object array.
> >
> > Has anyone managed to write and make work an object array
> > serializer on
> > Apache SOAP 2.2.  If so, do you have any
> > code/class/deployment descriptors I
> > could look at?
> >
> > Thanks,
> >
> > Andrew
> >
> > 12:00:18:362|15|S|010: <SOAP-ENV:Body>
> > 12:00:18:362|15|S|011: <SOAP-ENV:Fault>
> > 12:00:18:362|15|S|012:
> > <faultcode>SOAP-ENV:Server.Exception:</faultcode>
> > 12:00:18:362|15|S|013:
> > <faultstring>org/apache/soap/util/xml/Serializer</faultstring>
> > 12:00:18:362|15|S|014:
> > <faultactor>/soap/servlet/rpcrouter</faultactor>
> > 12:00:18:362|15|S|015: </SOAP-ENV:Fault>
> > 12:00:18:362|15|S|016:
> > 12:00:18:362|15|S|017: </SOAP-ENV:Body>
> >
> > ______________________________________________________________
> > __________
> >
> >  Andrew Simpson, SpeechWorks International, Inc.
> >  695 Atlantic Avenue, Boston, MA 02111, U.S.A.
> >  Voice: +1 617 428 4444,  Fax: +1 617 757 2211
> >  [EMAIL PROTECTED]  http://www.speechworks.com
> >
> >
> 

Reply via email to