How to POST a file with attributes as form-data to a REST service?

0
Hi all,   I am trying to POST a doc file to a REST service. I make use of the JAVA action of the RestServices with useformdata:true. As result I receive an error 500; internal server error/unknown error. Response status: 500 Internal Server Error, ETag: null, body: '{"succeeded":false,"shortMsg":"Unexpected error:null"}']     Seen this is normally a pretty simple call (see attachment), I think I miss something in my microflow. Could you guys tell me how I can build the same in a microflow?   Edit 1: I reproduced the same error with Postman (Chrome extension to execute webservices); when there is no templateFile i got the same error. So I think that in Mendix the file and the attributes are not well formed by their names into one object...   I do now as follow: 1 - filedocument object with 2 attributes (no binary attribute included) 2 - then I do a post with submist as formdata : true...
asked
1 answers
1

I think you are trying to create a multi-part form request with a specific name for your file data. To accomplish this, your domain model should look like this:

Note the association name- that's critical that it matches your desired parameter name. The binary contents of your file should of course be stored in "TheDocument". 

answered