Upload file to a Restful webservice

  
My project has the needs to send a list of key/value pairs and a PDF file to a Restful webservice on another system. The webservice consume multipart form data, the first part is a JSON which includes all the key/value pairs, the second part is the PDF file, the file is loaded from outsystem database.
Can anyone please give some instructions on how to implement it?
Hey Wei!

Could you help me understand a bit better what is the problem... Are you having trouble generating the JSON? Are you having trouble consuming the Restful webservice? Are you having trouble fetching the file from the database?

I believe you would have to consume the service, get the file from the database and invoke the web-service method with the required parameters...

Does this help? Cheers!
Hi Mario,

I saw an example in Java uses multipart form Content-Type to simulate a form submission in order to include some ordinary fields and files in one request. My problem is I am not sure how to do the same on Outsystems. The only option provided by Outsystems is JSON as I can see, I figure I can base64-encode the PDF file and embed it as a regular JSON field along with other key/value pairs. One downside I could see is base64-encode increases the file size by about 1/3.

Thanks for the link, that's the details I need to implement it.

Cheers
Wei