users@jersey.java.net

[Jersey] How to post an XML file using a Jersey Client?

From: amrutad <amruta.dhavalikar_at_adp.com>
Date: Thu, 15 Dec 2011 03:00:19 -0800 (PST)

        final WebResource service =
client.resource(UriBuilder.fromUri(WSURI).build());
        service.type(MediaType.APPLICATION_XML);
        service.accept(MediaType.TEXT_PLAIN);
        final Builder builder = service.header(HttpHeaders.AUTHORIZATION,
HEADER);
        
        File file = new File("/test.xml");
        builder.entity(file);
        final ClientResponse response = builder.post(ClientResponse.class);


I want to send an XML file and receive the response back. The code that I am
trying gives 400 BAD request, please could someone help. I am not sure what
is going wrong here.

--
View this message in context: http://jersey.576304.n2.nabble.com/How-to-post-an-XML-file-using-a-Jersey-Client-tp7096733p7096733.html
Sent from the Jersey mailing list archive at Nabble.com.