users@jersey.java.net

Passing files or very long strings into a RESTful webservice

From: Rameswara Sashi Kiran Challa <schalla_at_umail.iu.edu>
Date: Sun, 14 Mar 2010 23:55:19 -0400

Dear All,

(How do I get to know that my questions are answered when I post to this
mailing list. Where do I need to subscribe for this mailing list ? )

Earlier I had posted a question on passing a string with hyphens, slashes
using @PathParam. Here is that question
https://jersey.dev.java.net/servlets/ReadMsg?list=users&msgNo=10345

Thanks for your answers.

I got it working using @QueryParam by passing my InChI string as a
parameter. Is it correct to do this ??

Service A returns a String(in XML format) which is very long and I want to
pass that to another Service B which takes that long string, extracts some
particular information and should return an array. How should I be passing
this long string from Service A to Service B.

I was trying to write a client like this:

                Client client = Client.create();
        WebResource webResource = client.resource("
http://localhost:8080/CEfeed/atom/ceurl"); //url structure that I specified
in @Path.
        MultivaluedMap<String, String> queryParams = new
MultivaluedMapImpl();
        queryParams.add("url",
"http://wwmm.che.uk/ce/feed/orm/feed.xml");//passing the url as a
query parameter to the service
        String s = webResource.queryParams(queryParams).get(String.class);
        System.out.println(s);// this is printing out the xml string that
this service is supposed to return.

               // now pass this string s to 2nd webservice
        WebResource webResource1 = client.resource("
http://localhost:8080/InChIExtractor/atom/InChIs");
        MultivaluedMap<String, String> queryParams1 = new
MultivaluedMapImpl();
        queryParams1.add("atomfeed",s);
        String outInchis =
webResource1.queryParams(queryParams1).get(String.class); // I did not know
what to use here instead of String.class if I am getting an array.
        System.out.println(outInchis);

The second part does not work. I get the ClientHandlerException: Error
writing to server.

Am I supposed to create another client ?? What is the optimal way to do this
passing of long string to another service and how should that service return
array.

Please correct me as to where I am doiing it wrong.

Thanks in advance

Regards

-- 
Sashikiran Challa