Hi Joao, I suposse a better approach to expose a Hashtable than 2 Vectors one with keys and the other with values or using multidimensional Arrays is to export your Hashtable via a Vector or JavaBeans or an Arrays of JavaBeans. Each JavaBean will have 2 proporties: key and value. Whis way you will have the same effect but in my opinion in a cleaner way. At the other side you can reconstruct your Hashtable with this collection of beans.
JavaBeans are exposed without problems by Axis (is a JAX-RPC requirement).
 
Hope this help
Leonardo
----- Original Message -----
Sent: Tuesday, October 21, 2003 8:00 AM
Subject: Hashtable and Vector Question

Hi,
 
I am new to axis.
I did search the mailing list but I was unable to find answers to 3 distinct problems that I have to solve.
We have 3 diferent java classes. They are:
 
public class BooleanExample
{
  public boolean business(String input)
  { 
    boolean output = false;
   
    ... do something with output.
   
    return output;
  }
}
 
public class HashtableExample
{
  public Hashtable business(String input)
  { 
    Hashtable output = new Hashtable()
   
    ... fill output with data.
   
    return output;
  }
}
 
public class VectorOfHashtablesExample
{
  public Vector business(String input)
  { 
    Vector output = new Vector();
    Hashtable data = "" Hashtable()
   
    ... fill data
    ... add several data filled Hashtables to output
   
    return output;
  }
}
 
I am looking to expose these classes as a Web Service but I need to assure interop.
The way I see it, class one (BooleanExample) does not represent a problem.
The web service deployment descriptor would be something like:
 
<service name="BooleanExample" provider="java:RPC">
    <parameter name="className" value="BooleanExample"/>
    <parameter name="allowedMethods" value="business"/>
</service>
 
I read the following on the Axis manual:
 
"Java Collections
 
Some of the Collection classes, such as Hashtable do have serializers, but there is no formal interoperability with other SOAP implementations, and nothing in the SOAP specifications which covers complex objects. The most reliable way to send aggregate objects is to use arrays. In particular, .NET cannot handle them, though many Java SOAP implementations can marshall and unmarshall hash tables."
 
 
Supose I have the following hashtable: {key 1=value 1, key 2=value 2}
To assure interop do I have to convert this to two vectors? Like [key 1, key 2] for the keys, and  [value 1, value 2] for the values? Do I have to send then over the wire one at a time?
 
Now for the Vector. Ok, I could convert it to an Array using toArray, but I would still have an Array of Hashtables. No good.
So the first question I have is: can I use multidimensional String Arrays?
This way I would use the above solution for each Hashtable on the Vector, and then, only then, I would convert the Vector to an Array.
 
Any help is welcome.
Thanks
 
John
 
PS: you can email me at [EMAIL PROTECTED]
 
 
 
 
 
 
 

Reply via email to