users@jersey.java.net

Re: [Jersey] Struggling to post file to a REST web service through Jersey Client

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 09 Mar 2010 17:28:49 +0100

Hi Monika,

Your client code looks OK.

What is the server side? any more details in the server logs?

Paul.

On Mar 9, 2010, at 2:36 PM, Monika Solanki wrote:

> Hello,
>
> I am trying to send an XML file and get the response back as text/
> xml. The server is throwing 500. Please could someone help me with
> my code below
> {
> ClientConfig config = new DefaultClientConfig();
> Client client = Client.create(config);
> WebResource service = client.resource(getBaseURI());
> File f = new File("/home/monika/post.xml");
> System.out.println(f.exists());
> String response;
> response =
> service
> .type
> (MediaType.TEXT_XML).accept(MediaType.TEXT_XML).post(String.class, f);
>
> }
>
> private static URI getBaseURI() {
> return UriBuilder.fromUri(
> "http://lod.openlinksw.com/fct/service").build();
> }
>
> --
> Dr Monika Solanki
> F27 Department of Computer Science
> University of Leicester
> Leicester LE1 7RH
> United Kingdom
> Tel: +44 116 252 3828
> Google: 52.653791,-1.158414
> http://www.cs.le.ac.uk/people/ms491
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>