users@jax-rpc.java.net

RE: Errors encountered serializing arrays of primitive types embe dded in Maps, Vectors, or complex types.

From: Almeida, Timothy <timothya_at_firepond.com>
Date: Thu, 06 Feb 2003 11:16:15 -0600

Hi Doug,
Thought I'd do some tests again to verify what I'd reported, and also get
that call stack for you. I now can't seem to reproduce the problem with the
complex types, but do still see it with Maps, etc that contain arrays.
Here is the call stack:
     [java] java.rmi.ServerException: Internal Server Error (deserialization
error: deserialization error: unexpected element name: expected=element,
actual=item)
     [java] at
com.sun.xml.rpc.client.StreamingSender._raiseFault(StreamingSender.java:357)
     [java] at
com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:228)
     [java] at com.firepond.spc.SPC_Stub.call(SPC_Stub.java:263)
     [java] at test.SPCClient.useStub(Unknown Source)
     [java] at test.SPCClient.main(Unknown Source)

My client is essentially doing something like this:
                HashMap map = new HashMap();
      String s[] = {"1", "2", "3"};
      map.put( "mykey", s );
      System.out.println( "Call = " + service.call(map) );
where the service interface contains a method like:
        public Map call(Map map) throws RemoteException;
And the implementation class merely defines call() like this:
    public Map call(Map map)
    {
      return map;
    }
Hope this helps!
Tim
> -----Original Message-----
> From: Almeida, Timothy
> Sent: Thursday, February 06, 2003 10:45 AM
> To: 'Doug Kohlert'
> Subject: RE: Errors encountered serializing arrays of primitive types
> embedded in Maps, Vectors, or complex types.
>
> Am not sure what the version is (Where do I find the version number?), but
> I downloaded it on December 6th2002, if that provides a clue. Also, the
> file name of the install is jwsdp-1_0_01-windows-i586.exe -- so I assume
> its version 1.0.01
> I can't readily reproduce the stack trace now, without making code changes
> and rebuilding etc., but I can assure you that the errors are eminently
> reproducible. I do remember that the exception was being thrown by some
> class that had xml.encoding as part of its package name.
> For example, use of a complex type like the one below will reveal the
> problem -- due to the presence of the string array.
>
> public class Complex implements java.io.Serializable
> {
> private String str[];
> public Complex()
> {
> }
>
> public void setStr(String s[])
> {
> this.str = s;
> }
>
> public String[] getStr()
> {
> return this.str;
> }
>
> }
>
> Good luck...
> Tim
>
> -----Original Message-----
> From: Doug Kohlert [mailto:doug.kohlert_at_sun.com]
> Sent: Thursday, February 06, 2003 10:28 AM
> To: Almeida, Timothy
> Subject: Re: Errors encountered serializing arrays of primitive types
> embedded in Maps, Vectors, or complex types.
>
>
> Tim, what version of the JWSDP are you working on? I believe version
> 1.1 that is due out in a couple of weeks has a fix for this but
> I will try it to make sure. Can you send me an error message and/or
> stack trace that you were getting?
>
> Thanks
>
> Almeida, Timothy wrote:
> > Doug,
> > I thought I'd let you know about another significant serialization I'd
> > run across using the JAX-RPC RI.
> > When attempting to serialize a Map, Vector or any Complex type that
> > contains an array of any kind of primitive type, I experience errors.
> > (Recommend you try it out yourself.)
> > I've worked around this for my purposes, but thought I should let you
> > know since you seem to be associated with the JAX-RPC RI project.
> > Regards,
> > Tim
> >
> > Timothy Almeida
> > Advisory Technical Architect
> > firepond, Inc.
> >
> >
> >
> >
> > ------------------------------------------------------------------------
> >
>
>
> --
> Doug Kohlert
> Java Software Division
> Sun Microsystems, Inc.
> phone: 503 345-9806