Hi,

We've written a serializer and deserializer that handles ArrayList
Vector, Object[], Object[][], Object[][][], Object[][][][], ... etc.

They return everything to their original Java runtime type.
They are meant to be used with AXIS Alpha 3. The source
code files are enclosed as attachments. The AXIS project
can use any or all of the code in them.

Feel free to email me if you have any questions how they work.
Below I've put the tests we used.

John Munch
[EMAIL PROTECTED]



      Object[][] arg = new Object[2][4];

      String hello = new String("HELLO");
      Vector vector = new Vector();
      ArrayList list = new ArrayList();
      Object[] inner = new Object[2];
      inner[0] = hello;
      inner[1] = arg;
      list.add(inner);
      list.add(null);
      vector.add(hello);
      arg[0][0] = hello;
      arg[0][1] = hello;
      arg[0][2] = vector;
      arg[0][3] = inner;
      arg[1][0] = new Integer(42);
      arg[1][1] = null;
      arg[1][2] = list;
      arg[1][3] = arg;

      // This goes to a service that just returns whatever it gets.
      Object[][] result = (Object[][])call.invoke(new Object[] {arg});

      boolean correct =
         result.getClass() == Object[][].class &&
         result[0][0].equals(hello) &&
         result[0][1].equals(hello) &&
         result[0][2].getClass() == Vector.class &&
         ((String)((Vector)result[0][2]).get(0)).equals(hello) &&
         ((Vector)result[0][2]).size() == 1 &&
         result[0][3].getClass() == Object[].class &&
         ((String)((Object[])result[0][3])[0]).equals(hello) &&
         ((Object[])result[0][3])[1] == result &&
         ((Integer)result[1][0]).intValue() == 42 &&
         result[1][1] == null &&
         result[1][2].getClass() == ArrayList.class &&
         ((ArrayList)result[1][2]).get(0) == result[0][3] &&
         ((ArrayList)result[1][2]).get(1) == null &&
         result[1][3] == result;

      System.out.println(correct);

Attachment: ArraySerializer.java
Description: application/unknown-content-type-java_auto_file

Attachment: ArrayDeserializer.java
Description: application/unknown-content-type-java_auto_file

Reply via email to