Return Complex Types.
How do I access an Array that is returned in a HashMap? The server returns a HashMap with the following values {responseCode=OK,people=[Array of People]} I cast the response to a HashMap which then lets me access the objects by key, although the Array simple returns Object, and I cant access the Data. ie I call HashMap response = (HashMap)client.execute(myMethod,param); String responseCode = (String)response.get(responseCode); System.out.println(responseCode); (Prints OK); Object[] people = (Object[]) response.get(people); System.out.println(people); (Prints java.lang.Object); Anyone can help me?
Re: Return Complex Types.
Hi, since you don't get a class cast exception, everything seems to be working as it should be. in your print you probably get something like [Ljava.lang.Object;@1100d7a but this means that you have array of Objects Thus you can access the first person as people[0]. The corresponding type will be based on how the array of people was constructed. BR Stano On Mon, Apr 26, 2010 at 20:44, David J. da...@styleflare.com wrote: How do I access an Array that is returned in a HashMap? The server returns a HashMap with the following values {responseCode=OK,people=[Array of People]} I cast the response to a HashMap which then lets me access the objects by key, although the Array simple returns Object, and I cant access the Data. ie I call HashMap response = (HashMap)client.execute(myMethod,param); String responseCode = (String)response.get(responseCode); System.out.println(responseCode); (Prints OK); Object[] people = (Object[]) response.get(people); System.out.println(people); (Prints java.lang.Object); Anyone can help me?
Re: Return Complex Types.
On Mon, Apr 26, 2010 at 2:07 PM, Stanislav Miklik stanislav.mik...@gmail.com wrote: hm, try wireshark or something similar. I don't know better solution. Seconded. Capture the session in Wireshark, and then follow the TCP stream. You will then see both the XMLPRC request and response, and it will probably become obvious what is going on. -Craig -- http://inconnu.islug.org/~ink finger i...@inconnu.islug.org for PGP block