title: Phonegap upload pictures multipart/form-data - iPad application- Worklightv6 - WAS
body: <p>I'm trying to upload pictures using PhoneGap under an ipad Application (using worklightV6) to a Websphere Application Server in a RestFul API.</p>
  
  <p>my web browser code looks like this : </p>
  
  <pre><code>var photosURI = [];
  var manageDeviceDocumentsURI = "http://IP:PORT/****/rest/AmanageDevicesDocuments.upload";
  
  function cameraSuccessCallback(imageURI){
     photosURI.push(imageURI);
  }
  
  $("#content").on("click", "#takePicture", function(){
     cameraOptions = {quality : 20, allowEdit: true, desinationType.FILE_URI };
     navigator.camero.getPicture(cameraSuccessCallback, cammeraErrorCallback, cameraOptions);
  });
  
  $("#content").on("click", "#uploadPictures", function(){
  
     function fail(error){
       alert("An error has occured: Code " + error.code);
       console.log("Upload error source " + error.source);
       console.log("Upload error target " + error.target); 
     }
  
     function win(){
       alert('transfert ok');
     }
  
     var fileURI = photosURI.pop();
     var options = new FileUploadOptions();
     options.fileKey = "file";
     options.fileName = fileURI.substr(fileURI.lastIndexOf('/') + 1);
     options.mimeType = "multipart/form-data";
  
     var ft = new FileTransfert();
     ft.upload(fileURI, encodeURI(manageDeviceDocumentsURI), win, fail, otpions);
  });
  </code></pre>
  
  <p>My java code on the server looks like this :</p>
  
  <pre><code>@Path("manageDeviceDocuments")
  public class ManageDeviceDocuments {
  
      @POST
      @Path("upload")
      @Consumes(MediaType.MULTIPART_FORM_DATA)
      @Produces(MediaType.APPLICATION_JSON)
      public JSONArray upload(@Context ServletConfig servletConfig,
                              @Context HttpHeaders httpHeaders, @Context UriInfo uriInfo,
                              BufferedInMultiPart bimp) throws IOException {
  
      }
  
  }
  </code></pre>
  
  <p>And i'm getting the following error on the web browser : </p>
  
  <blockquote>
    <p>Error 415 : Unsupported Media Type, code 3 ...</p>
  </blockquote>
  
  <p>And this on the server : </p>
  
  <blockquote>
    <p>A message body reader for Java class
    org.apache.wink.common.model.multipart.BufferedInMultiPart, and Java
    type class org.apache.wink.common.model.multipart.BufferedInMultiPart,
    and MIME media type
    multipart/form-data;boundary=+++++org.apache.cordova.formBoundary was
    not found. The registered message body readers compatible with the
    MIME media type are:
    <em>/</em> ->   com.sun.jersey.core.impl.provider.entity.FormProvider   com.sun.jersey.core.impl.provider.entity.MimeMultipartProvider<br>
    com.sun.jersey.core.impl.provider.entity.StringProvider<br>
    com.sun.jersey.core.impl.provider.entity.ByteArrayProvider<br>
    com.sun.jersey.core.impl.provider.entity.FileProvider<br>
    com.sun.jersey.core.impl.provider.entity.InputStreamProvider<br>
    com.sun.jersey.core.impl.provider.entity.DataSourceProvider<br>
    com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$General
    com.sun.jersey.core.impl.provider.entity.ReaderProvider<br>
    com.sun.jersey.core.impl.provider.entity.DocumentProvider<br>
    com.sun.jersey.core.impl.provider.entity.SourceProvider$StreamSourceReader
    com.sun.jersey.core.impl.provider.entity.SourceProvider$SAXSourceReader
    com.sun.jersey.core.impl.provider.entity.SourceProvider$DOMSourceReader
    com.sun.jersey.json.impl.provider.entity.JSONJAXBElementProvider$General
    com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$General
    com.sun.jersey.core.impl.provider.entity.XMLListElementProvider$General
    com.sun.jersey.core.impl.provider.entity.XMLRootObjectProvider$General
    com.sun.jersey.core.impl.provider.entity.EntityHolderReader<br>
    com.sun.jersey.json.impl.provider.entity.JSONRootElementProvider$General
    com.sun.jersey.json.impl.provider.entity.JSONListElementProvider$General</p>
  </blockquote>
  
  <p>Thank you in advance for your help !</p>