Could not find message body reader for type: interface org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput

1,298 views
Skip to first unread message

Julien Paulhan

unread,
Oct 19, 2016, 6:30:26 AM10/19/16
to okapi-devel
Hello, I have a problem no matter what I do, to upload files to Longhorn using the REST method:

Could not find message body reader for type: interface org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput of content type: text/html</u></p><p><b>description</b> <u>The request sent by the client was syntactically incorrect.

What do I need to do? Install jboss? There is a jar for jboss resteasy included in the package but it seems I need to configure something somewhere? I tried to add this information in the <repositories> in the pom.xml file
Thanks,

Julien

Chase Tingley

unread,
Oct 19, 2016, 2:26:09 PM10/19/16
to okapi...@googlegroups.com
Hi Julien,

Can you tell me more about how you are making the request, and what kind of content you're sending to Longhorn?

--
You received this message because you are subscribed to the Google Groups "okapi-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to okapi-devel+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Julien Paulhan

unread,
Oct 20, 2016, 4:59:15 AM10/20/16
to okapi-devel
Hi Chase,

Thanks for taking the time to look into it.
I am basically just attempting to send files to Longhorn using the REST interface
I can create projects all fine - with the code below in Python (that was easier to make some tests with Python):

# beginning of code, loading Python requests lib etc.

import requests
url = 'http://10.0.0.32:8080/okapi-longhorn/'
response = requests.post(url+'projects/new', data=data)

# creation of new project works great

response = requests.get(url+'projects/')

# retrieval of projects works like a charm too
# now to add a file:

payload = "hello world!"
headers = {'accept-encoding': 'multipart/form-data', 'content-type': 'text/html'}
response = requests.post(url+'projects/1/inputFiles/test.html', data=payload, verify=False, headers=headers)

# here it doesn't work
I have tried lots of possible configurations (without the filename or whatever) but then I get error 405 meaning that I am doing it wrong
Here I get error 400
Thanks if you can help me - I am badly stuck at this stage
Thanks a lot,

Julien
To unsubscribe from this group and stop receiving emails from it, send an email to okapi-devel...@googlegroups.com.

Julien Paulhan

unread,
Oct 24, 2016, 9:25:49 AM10/24/16
to okapi-devel
Hi anyone,

Any feedback regarding this? I am used to working with API and REST interfaces so I don't really get why it's not working here...
Thanks

Julien

Chase Tingley

unread,
Oct 24, 2016, 1:27:24 PM10/24/16
to okapi...@googlegroups.com
Hi Julien,

Sorry, I didn't have much time to look at this over the weekend.

I usually work with the APIs through the java api library, so I'm going to need to dive into this a bit to see what's going wrong.


To unsubscribe from this group and stop receiving emails from it, send an email to okapi-devel+unsubscribe@googlegroups.com.

Chase Tingley

unread,
Oct 24, 2016, 1:50:01 PM10/24/16
to okapi...@googlegroups.com
Hi Julien,

There were two issues.  First, when adding an inputFile, use PUT instead of POST.  Second, Longhorn sort of obscurely looks for a request part called "inputFile" to contain payload data.

I was able to make it work using the files=dict(...) syntax for multipart/form-data as described here.  So working code would be:

payload = "hello world!"
response = requests.put(url+'projects/1/inputFiles/test.html', files=dict(inputFile=payload))


Julien Paulhan

unread,
Oct 26, 2016, 10:56:17 AM10/26/16
to okapi-devel
Hi Chase,

I didn't have time to check yesterday. It's working - as expected. Thank you very much! :)

Julien
Reply all
Reply to author
Forward
0 new messages