Since XmlRpcArray is a simple ArrayList you can use the get(int index) method to fetch a value from it, and then typecast it into whatever type you expect at that index from the service.
XmlRpcArray, however, have helper methods to do this typecasting for you (which is essentially the only service XmlRpcArray has over the original ArrayList), so if your service returns an XML-RPC Array with an XML-RPC Struct in the first element of the result, the following code would work:
Hi,
I want to fetch some data from a xmlrpc service, and I can successfully get the data when the return is a struct.
struct
int "id"
string "name"
The code I use is:
But I have no idea on how to get the results when the return is a struct whithin an array:
array
struct
int "id"
string "name"
I know that a XmlRpcArray is an ArrayList but I dont know how to use it in this case.
Can someone please explain?
//Claes
Hi Claes,
Since XmlRpcArray is a simple ArrayList you can use the get(int index) method to fetch a value from it, and then typecast it into whatever type you expect at that index from the service.
XmlRpcArray, however, have helper methods to do this typecasting for you (which is essentially the only service XmlRpcArray has over the original ArrayList), so if your service returns an XML-RPC Array with an XML-RPC Struct in the first element of the result, the following code would work:
Hope that helps,
Greger.
Hi Greger!
Thanks for the quick reply! :)
I changed my code to use the helper methods instead and it is much cleaner now..
I also tried your code and it works very well, thanks!
//Claes
Last comment should read;
I tried your code on struct in array and it works very well..
Thanks again!
//Claes