From: Vasudevan C. <vco...@gm...> - 2017-01-02 20:12:15
|
Hi, Is it possible to set a json object data followed by binary data in Multi-part file upload? I had a sample HTML file with the option to upload the file and I tried uploading the file. But the server was throwing error message as follows: <Errors> <Error> <errorCode>INVALID_MULTIPART_REQUEST</errorCode> <message>Multipart message must include a non-binary part</message> </Error> </Errors> Below is the format in which the server is expecting the multi-part data *Service resource* -- > https://congruent-soft--proservqa.cs31.my.salesforce.com /services/data/v23.0/sobjects/Document/ -H "Authorization: Bearer token" -H "Content-Type: multipart/form-data; boundary=\"boundary_string\"" --data-binary @newdocument.json *Sample request body* --boundary_string Content-Disposition: form-data; name="entity_document"; Content-Type: application/json { "Description" : "Sample document uploaded from SixthSense thru integration", "Keywords" : "integrate,sixthsense,create", "FolderId" : "00l28000000WRUp", "Name" : "Integration document", "Type" : "pdf" } --boundary_string Content-Type: application/pdf Content-Disposition: form-data; name="Body"; filename="IntegrationDocument.pdf" <Binary data goes here.> --boundary_string-- Is there a way to achieve the above using HTMLUnit?. I am using HTMLUnit 2.23. Any suggestions/pointers/help to solve this issue is appreciated. Wishing you all a Very Happy New Year Regards Vasu |