Here is a fix for handling 2 dimensional arrays.

Ari Autio <[email protected]> Wed, 2 Jul 2003 15:32:53 +0300 (EEST)
Newsgroups gmane.comp.java.enhydra.ksoap
Message-ID <[email protected]>
Hi.

I made a small fix to SoapParser class, to enable support for 2
dimensional arrays. I tested it quickly, and had no problems.
Check it, and please post your thoughts.

This code might even work for all arrays. (1, 2, 3, .. dimensionals)

Here comes the code:

In SoapParser.java in function readVector(Vector, ElementType) do the
following changes.

1.
 Change first occurrence of line
   size = getIndex(attr, cut1, -1);
 to
   size = getIndex(attr, type.lastIndexOf('['), -1);

2.
 Replace these lines (near the end of the file):
   v.setElementAt
     (read (v, position, namespace, name, elementType), position);

   position++;
   parser.skip ();
 With this:
   Vector tmp = ((StartTag)parser.peek()).getAttributes();
   //NOTE! This if condition is not perfect.
   //There ARE cases when this does not work.
   //I am just too lazy to fix it :)
   if (tmp != null && tmp.size() > 0 &&
       ((Attribute)tmp.elementAt(0)).getName().equals("arrayType")) {

     Vector vec = new Vector();
     readVector(vec, ElementType.OBJECT_TYPE);
     v.setElementAt(vec, position);

     position++;
     parser.skip;
   }
   else {
     // implicit handling of position exceeding specified size
     v.setElementAt
       (read (v, position, namespace, name, elementType), position);

     position++;
     parser.skip ();
   }

Recompile, test and post your comments.
-Ari Autio