You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@xml.apache.org by Andrew Simpson <an...@speechworks.com> on 2002/01/09 22:52:24 UTC

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
 andrew.simpson@speechworks.com  http://www.speechworks.com



RE: Serializing an array of beans

Posted by Chris Means <cm...@empowergeo.com>.
Andrew,

I can send you one of my serializers, however, I used the Apache-SOAP ones
as a template, so they're not much different.

-Chris

> -----Original Message-----
> From: Andrew Simpson [mailto:andrew.simpson@speechworks.com]
> Sent: Wednesday, January 09, 2002 4:33 PM
> To: cmeans@empowergeo.com; Soap-User@Xml. Apache. Org
> Subject: RE: Serializing an array of beans
>
>
>
> Hi Chris, this looks promising.
>
> However, I'm having trouble using ANY type of home-grown serializer, and
> would like to use one which someone knows works (other than the
> apache ones
> which come with the distribution).
>
> Thanks,
>
> Andrew
>
> -----Original Message-----
> From: Chris Means [mailto:cmeans@empowergeo.com]
> Sent: Wednesday, January 09, 2002 5:03 PM
> To: soap-user@xml.apache.org
> Subject: RE: Serializing an array of beans
>
>
> Unless I misunderstood your problem.
>
> You just put the 'array' brackets next to the object class name,
> like this:
>
>     String [] fieldNames ;
>
>     ...
>
>     if (fieldNames != null)
>     {
>       xjmr.marshall (inScopeEncStyle,
>                      String[].class,
>                      fieldNames,
>                      "fieldNames",
>                      sink,
>                      nsStack,
>                      ctx) ;
>
>       sink.write (StringUtils.lineSeparator) ;
>     }
>
>
>
> > -----Original Message-----
> > From: Andrew Simpson [mailto:andrew.simpson@speechworks.com]
> > Sent: Wednesday, January 09, 2002 3:52 PM
> > To: soap-user@xml.apache.org
> > 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
> >  andrew.simpson@speechworks.com  http://www.speechworks.com
> >
> >
>


RE: Serializing an array of beans

Posted by Chris Means <cm...@empowergeo.com>.
Andrew,

I can send you one of my serializers, however, I used the Apache-SOAP ones
as a template, so they're not much different.

-Chris

> -----Original Message-----
> From: Andrew Simpson [mailto:andrew.simpson@speechworks.com]
> Sent: Wednesday, January 09, 2002 4:33 PM
> To: cmeans@empowergeo.com; Soap-User@Xml. Apache. Org
> Subject: RE: Serializing an array of beans
>
>
>
> Hi Chris, this looks promising.
>
> However, I'm having trouble using ANY type of home-grown serializer, and
> would like to use one which someone knows works (other than the
> apache ones
> which come with the distribution).
>
> Thanks,
>
> Andrew
>
> -----Original Message-----
> From: Chris Means [mailto:cmeans@empowergeo.com]
> Sent: Wednesday, January 09, 2002 5:03 PM
> To: soap-user@xml.apache.org
> Subject: RE: Serializing an array of beans
>
>
> Unless I misunderstood your problem.
>
> You just put the 'array' brackets next to the object class name,
> like this:
>
>     String [] fieldNames ;
>
>     ...
>
>     if (fieldNames != null)
>     {
>       xjmr.marshall (inScopeEncStyle,
>                      String[].class,
>                      fieldNames,
>                      "fieldNames",
>                      sink,
>                      nsStack,
>                      ctx) ;
>
>       sink.write (StringUtils.lineSeparator) ;
>     }
>
>
>
> > -----Original Message-----
> > From: Andrew Simpson [mailto:andrew.simpson@speechworks.com]
> > Sent: Wednesday, January 09, 2002 3:52 PM
> > To: soap-user@xml.apache.org
> > 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
> >  andrew.simpson@speechworks.com  http://www.speechworks.com
> >
> >
>


RE: Serializing an array of beans

Posted by Andrew Simpson <an...@speechworks.com>.
Hi Chris, this looks promising.

However, I'm having trouble using ANY type of home-grown serializer, and
would like to use one which someone knows works (other than the apache ones
which come with the distribution).

Thanks,

Andrew

-----Original Message-----
From: Chris Means [mailto:cmeans@empowergeo.com]
Sent: Wednesday, January 09, 2002 5:03 PM
To: soap-user@xml.apache.org
Subject: RE: Serializing an array of beans


Unless I misunderstood your problem.

You just put the 'array' brackets next to the object class name, like this:

    String [] fieldNames ;

    ...

    if (fieldNames != null)
    {
      xjmr.marshall (inScopeEncStyle,
                     String[].class,
                     fieldNames,
                     "fieldNames",
                     sink,
                     nsStack,
                     ctx) ;

      sink.write (StringUtils.lineSeparator) ;
    }



> -----Original Message-----
> From: Andrew Simpson [mailto:andrew.simpson@speechworks.com]
> Sent: Wednesday, January 09, 2002 3:52 PM
> To: soap-user@xml.apache.org
> 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
>  andrew.simpson@speechworks.com  http://www.speechworks.com
>
>


RE: Serializing an array of beans

Posted by Andrew Simpson <an...@speechworks.com>.
Hi Chris, this looks promising.

However, I'm having trouble using ANY type of home-grown serializer, and
would like to use one which someone knows works (other than the apache ones
which come with the distribution).

Thanks,

Andrew

-----Original Message-----
From: Chris Means [mailto:cmeans@empowergeo.com]
Sent: Wednesday, January 09, 2002 5:03 PM
To: soap-user@xml.apache.org
Subject: RE: Serializing an array of beans


Unless I misunderstood your problem.

You just put the 'array' brackets next to the object class name, like this:

    String [] fieldNames ;

    ...

    if (fieldNames != null)
    {
      xjmr.marshall (inScopeEncStyle,
                     String[].class,
                     fieldNames,
                     "fieldNames",
                     sink,
                     nsStack,
                     ctx) ;

      sink.write (StringUtils.lineSeparator) ;
    }



> -----Original Message-----
> From: Andrew Simpson [mailto:andrew.simpson@speechworks.com]
> Sent: Wednesday, January 09, 2002 3:52 PM
> To: soap-user@xml.apache.org
> 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
>  andrew.simpson@speechworks.com  http://www.speechworks.com
>
>


RE: Serializing an array of beans

Posted by Chris Means <cm...@empowergeo.com>.
Unless I misunderstood your problem.

You just put the 'array' brackets next to the object class name, like this:

    String [] fieldNames ;

    ...

    if (fieldNames != null)
    {
      xjmr.marshall (inScopeEncStyle,
                     String[].class,
                     fieldNames,
                     "fieldNames",
                     sink,
                     nsStack,
                     ctx) ;

      sink.write (StringUtils.lineSeparator) ;
    }



> -----Original Message-----
> From: Andrew Simpson [mailto:andrew.simpson@speechworks.com]
> Sent: Wednesday, January 09, 2002 3:52 PM
> To: soap-user@xml.apache.org
> 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
>  andrew.simpson@speechworks.com  http://www.speechworks.com
>
>


RE: Serializing an array of beans

Posted by Chris Means <cm...@empowergeo.com>.
Unless I misunderstood your problem.

You just put the 'array' brackets next to the object class name, like this:

    String [] fieldNames ;

    ...

    if (fieldNames != null)
    {
      xjmr.marshall (inScopeEncStyle,
                     String[].class,
                     fieldNames,
                     "fieldNames",
                     sink,
                     nsStack,
                     ctx) ;

      sink.write (StringUtils.lineSeparator) ;
    }



> -----Original Message-----
> From: Andrew Simpson [mailto:andrew.simpson@speechworks.com]
> Sent: Wednesday, January 09, 2002 3:52 PM
> To: soap-user@xml.apache.org
> 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
>  andrew.simpson@speechworks.com  http://www.speechworks.com
>
>