Hi,
I have RESTful service for file upload as below @POST @Path("/fileupload") @Consumes(MediaType.MULTIPART_FORM_DATA) public void fileUpload(MultipartBody body) { System.out.println("The API is called...."); try { System.out.println("start post"); List<Attachment> attachments = body.getAllAttachments(); DataHandler dataHandler = attachments.get(0).getDataHandler(); InputStream inputStream = dataHandler.getInputStream(); OutputStream outputStream = new FileOutputStream(new File("C:/studentservice/new.pdf")); IOUtils.copy(inputStream, outputStream); inputStream.close(); outputStream.close(); System.out.println("end post"); } catch (Exception e) { e.printStackTrace(); } } I am trying to upload file from Apache HTTP client library as below HttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost("http://localhost:8080/StudentService-RS/studentservice/fileupload"); FileBody fileBody = new FileBody(new File("C:\\test\\test.pdf")); System.out.println(fileBody.getFilename()); MultipartEntity reqEntity = new MultipartEntity(); reqEntity.addPart("file1", fileBody); httpPost.setEntity(reqEntity); httpClient.execute(httpPost); But this client does not invoking the service. Am I missing something here? Thanks -- View this message in context: http://cxf.547215.n5.nabble.com/RESTful-file-upload-problem-tp5725256.html Sent from the cxf-user mailing list archive at Nabble.com.