setRequestBody is deprecated in HttpClient 3.x. You should instead use setRequestEntity(RequestEntity).

setRequestBody is removed in HttpClient 4.x.

AFAIK, Jersey (JAX-RS implementation from Sun) Client API does not support this method.

-Arul

deniak wrote:
Hi all,

I'm just starting with web services and CXF and I'd like to know if it's
possible to deal with the request body with CXF.

I just created a client like that:

File customer = new File("pathToXMLFile");
File body = new File("AZipFile");
PutMethod put = new PutMethod("http://localhost:8080/test/new";);
put.addRequestHeader("Accept", "text/xml");
FileRequestEntity entity = new FileRequestEntity(customer, "text/xml;
charset=ISO-8859-1");
put.setRequestEntity(entity);
put.setRequestBody(body);
HttpClient httpclient = new HttpClient();
httpclient.executeMethod(put);


Here's my server:

@Path("test")
public class TestServlet {
        @PUT
        @Path("/new")
        public String testPut(Customer customer) {
              .....
        }
}


My question is how do I get the requestBody in my server (i.e. zipFile)??
I can deal with the customer parameter which is a xml file (from
requestentity) but
not with requestBody?
Has anyone ever done it?
Thanks for your support.

Ramku

Reply via email to