0

I would like to get the information of an Object.

I call a Webservice form a client, and get the response.

Object result = envelope.getResponse();

The Webservice returns an ArrayList<String>

How do I access the data ?

The Webservice fills the ArrayList like this, the information are parsed from a XML file.

tempDataStorage.add(getValue("ITEM_NAME", element));
tempDataStorage.add(getValue("VALUE", element));
tempDataStorage.add(getValue("CURRENCY", element));
tempDataStorage.add(getValue("DESCRIPTION", element));

return tempDataStorage;

To be more specific:

How can I get the ITEM_NAME, VALUE, CURRENCY, DESCRIPTION into a String variables, on the Client side?

Please tell me, if you need me to provide more information.

Thank you!

1
  • did you tried to cast your result to ArrayList<String>? Commented Aug 5, 2013 at 8:48

3 Answers 3

3

Cast your result to ArrayList<String> and use ArrayList#get(int) method.

like

ArrayList<String> resultList = (ArrayList<String>) result;

Then you know the story right ?? :)

Remember index starts from 0

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you very very much! Yeah, sure. I don't know why it didn't come into my mind, to simply cast it ...
2

Cast to an ArrayList.

((ArrayList)object).get(itemindex);

That should work.

Comments

2

Casting to ArrayList can give you the solution

((ArrayList)object).get(i) // i is the index 

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.