Quantcast

Sending a Text data followed by BInary Data in Multi-part file upload using HTMLUnit

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Sending a Text data followed by BInary Data in Multi-part file upload using HTMLUnit

Vasudevan Comandur
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

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Htmlunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-user
Loading...