title: 415 Unsupported Media Type error when uploading file to Webservice through Postman
body: <p>I have used Jersey Restful API to create a web service and I have the below:</p>
  
  <pre><code>@POST
  @Path("/process/")
  @Consumes({MediaType.MULTIPART_FORM_DATA})
  @Produces({MediaType.APPLICATION_JSON})
  public Response process(@FormDataParam("upload") InputStream is, @FormDataParam("upload") FormDataContentDisposition formData);
  </code></pre>
  
  <p>I have used the following dependencies:</p>
  
  <pre><code>   &lt;dependency&gt;
         &lt;groupId&gt;javax.ws.rs&lt;/groupId&gt;
         &lt;artifactId&gt;javax.ws.rs-api&lt;/artifactId&gt;
         &lt;version&gt;2.1-m01&lt;/version&gt;
     &lt;/dependency&gt;
  
      &lt;!-- https://mvnrepository.com/artifact/com.sun.jersey.contribs/jersey-multipart --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.sun.jersey.contribs&lt;/groupId&gt;
          &lt;artifactId&gt;jersey-multipart&lt;/artifactId&gt;
          &lt;version&gt;1.8&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;!-- https://mvnrepository.com/artifact/org.glassfish.jersey.core/jersey-server --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.sun.jersey&lt;/groupId&gt;
          &lt;artifactId&gt;jersey-server&lt;/artifactId&gt;
          &lt;version&gt;1.8&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;!-- https://mvnrepository.com/artifact/javax.ws.rs/jsr311-api --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.ws.rs&lt;/groupId&gt;
          &lt;artifactId&gt;jsr311-api&lt;/artifactId&gt;
          &lt;version&gt;1.1.1&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;!-- https://mvnrepository.com/artifact/commons-fileupload/commons-fileupload --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;commons-fileupload&lt;/groupId&gt;
          &lt;artifactId&gt;commons-fileupload&lt;/artifactId&gt;
          &lt;version&gt;1.3&lt;/version&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p>Configuration in Web.xml:</p>
  
  <pre><code>    &lt;context-param&gt;
          &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
          &lt;param-value&gt;/WEB-INF/ws-context.xml&lt;/param-value&gt;
      &lt;/context-param&gt;
  </code></pre>
  
  <p>in ws-context.xml, I have this part:</p>
  
  <pre><code>&lt;bean id="restManagerService" class="com.rs.service.impl.RestManagerServiceImpl"&gt;
          &lt;property name="restRequestService" ref="restRequestService" /&gt;
      &lt;/bean&gt;
  
      &lt;bean id="jsonProvider" class="com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider" /&gt;
      &lt;bean id="multipartResolver"
          class="org.springframework.web.multipart.commons.CommonsMultipartResolver"&gt;
          &lt;property name="maxUploadSize" value="100000" /&gt;
      &lt;/bean&gt;
  
      &lt;jaxrs:server id="userManagerREST" address="/rest/v1"&gt;
          &lt;jaxrs:serviceBeans&gt;
              &lt;ref bean="restManagerService" /&gt;
          &lt;/jaxrs:serviceBeans&gt;
  
          &lt;jaxrs:providers&gt;
              &lt;ref bean='jsonProvider' /&gt;
              &lt;ref bean='multipartResolver' /&gt;
              &lt;bean class="com.rs.exception.ExceptionHandler" /&gt;
          &lt;/jaxrs:providers&gt;
      &lt;/jaxrs:server&gt;
  </code></pre>
  
  <p>Now to test this, I am using Postman app to send a Post request. Below is the content from the <em>code</em> window:</p>
  
  <pre><code>Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryxxxxxxxxx
  
  ------WebKitFormBoundaryxxxxxxxxx
  Content-Disposition: form-data; name="upload"; filename="test.json"    
  </code></pre>
  
  <p>I have already referred to several samples on google, like <a href="https://www.mkyong.com/webservices/jax-rs/file-upload-example-in-jersey/" rel="nofollow noreferrer">this</a> , <a href="https://www.concretepage.com/webservices/upload-file-using-restful-web-services-jax-rs" rel="nofollow noreferrer">this</a>,  and <a href="https://stackoverflow.com/questions/25797650/fileupload-with-jax-rs">this</a> and I see that I have provided the parameters correctly but I still get 415 Unsupported Media Type error in Postman. I have several other web services in this project which consumes MediaType application/json so the project configuration shouldn't be an issue. </p>
  
  <p>Can somebody please shed some light as to what is wrong here.</p>
  
  <p>UPDATE: Added additional details related to all jersey and WS related dependencies used and important content from the web.xml file</p>