Hi,
What would be the syntax of the response representation so that it can
be converted to an array of strings, comma separated values?
You need write a MessageBodyWriter that supports the parameterized
type Collection<String> (and extensions of that so List and ArrayList
could be supported).
Then in the client API you need to register that class of
MessageBodyWriter with the ClientConfig, then you would do something
like this:
List<String> ls = r.accept(MediaType.TEXT_PLAIN_TYPE).
type(MediaType.APPLICATION_XML_TYPE).
post(new GenericType<List<String>() {}, s);
On Mar 16, 2010, at 6:33 AM, Rameswara Sashi Kiran Challa wrote:
> Hello All,
>
> Using this in the client I am able to get a String as output as my
> service is returning a string.
>
> Client client = Client.create();
> WebResource webResource = client.resource("http://localhost:8080/abcExtractor/abcs
> ");
>
> String outabcs =
> webResource
> .accept
> (MediaType
> .TEXT_PLAIN_TYPE
> ).type(MediaType.APPLICATION_XML_TYPE).post(String.class,s);
>
> (Here String s is from a different service)
>
> Instead of returning a string by posting this string s, I want to be
> able to return an Array of Strings or an ArrayList<String>
>
> How do I do this in the client ?
>
> I can return an Array or ArrayList in my webservice. How do I get
> the Array or ArrayList that my service returns, in the client ?
>
Only for JAXB classes, unless you write a corresponding
MessageBodyReader.
Paul.