Home 415 Unsupported MediaType for Content-Type = Mulitpart/form-data
Reply: 0

415 Unsupported MediaType for Content-Type = Mulitpart/form-data

user5761
1#
user5761 Published in September 19, 2018, 9:08 am

I have a REST API which ONLY @Produces(MediaType.APPLICATION_JSON) and does not @Consume any MediaType.

Even still when I am consuming this REST API by creating an HTTP Request where MediaType is being set to multipart/form-data, I am still recieving:

HTTP/1.1 415 Unsupported Media Type

in raw HTTP Response.

However, when I am setting Content-Type to application/json, which this REST API @Produces, I am getting a proper HTTP Response.

Below is the REST API Annotations:

@POST
@Path("/somePath")
@Produces(MediaType.APPLICATION_JSON)
public JSONObject addDocument(AddDocBean addDocBean) {
...

"Now why do I want to send Content-Type as Multipart/form-data?"

That is because I am using this service to upload a file to the server and the file is to be sent in a BASE64 format. Now the size of file is about 20Mb which I have been suggested is better sent as multipart/form-data

But HTTP server is unable to process this request returning ERROR 415 Unsupported MediaType in response.

REST client being used : SoapUI 5.4.0

What could possibly be wrong?

share|improve this question

1 Answer 1

active oldest votes
up vote 0 down vote
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.418697 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO