Help uploading excel spreadsheet for processing on server
Testing API that processes excel spreadsheet and populates database from entries. Raw REST request in SoapUI looks like this:
POST http://localhost:4200/api/claim/import-claims HTTP/1.1 Content-Type: multipart/form-data; boundary="----=_Part_11_1453044361.1558528114738" MIME-Version: 1.0 Authorization: Bearer <token redacted> Origin: http://localhost:4200 Accept: application/json, text/plain, */* User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36 Referer: http://localhost:4200/authenticated/import-claims Connection: keep-alive Host: localhost:4200 Accept-Encoding: gzip, deflate, br Accept-Language: en-US,en;q=0.9 Content-Length: 44582 ------=_Part_11_1453044361.1558528114738 Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet Content-Transfer-Encoding: binary Content-Disposition: form-data; name="claimSpreadsheet"; filename="Mass Tort Upload Spreadsheet revised.xlsx" PK...... etc....
Raw response looks like this:
HTTP/1.1 500 Internal Server Error X-Powered-By: Express access-control-allow-origin: * connection: close date: Wed, 22 May 2019 12:28:34 GMT content-type: application/json; charset=utf-8 server: Kestrel cache-control: no-store transfer-encoding: chunked vary: Origin access-control-allow-credentials: true "An error occurred while processing your request."
Uploading In the web page, the request looks like this:
POST /api/claim/import-claims HTTP/1.1 Host: localhost:4200 Connection: keep-alive Content-Length: 22238 Accept: application/json, text/plain, */* Origin: http://localhost:4200 Authorization: Bearer <token redacted> User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)
Chrome/74.0.3729.157 Safari/537.36
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryP1io8KIswhlqBXac Referer: http://localhost:4200/authenticated/import-claims Accept-Encoding: gzip, deflate, br Accept-Language: en-US,en;q=0.9
with Form Data looking like this:
------WebKitFormBoundaryP1io8KIswhlqBXac Content-Disposition: form-data; name="claimSpreadsheet"; filename="Mass Tort Upload Spreadsheet revised.xlsx"
Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
------WebKitFormBoundaryP1io8KIswhlqBXac--
and finally, Response looks like this:
HTTP/1.1 200 OK X-Powered-By: Express access-control-allow-origin: * connection: close date: Wed, 22 May 2019 12:07:42 GMT content-type: application/json; charset=utf-8 server: Kestrel cache-control: no-store transfer-encoding: chunked vary: Origin access-control-allow-credentials: true
I have also tried to have ReadyAPI Discover API with its Internal Browser. I was able to upload the document in this manner, but had to modify the code to allow all filetypes as the Internal browser kept rejecting the allowed filetype as not allowable. The resulting API Discovered request looks like this:
POST http://localhost:4200/api/claim/import-claims HTTP/1.1 Origin: http://localhost:4200 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Authorization: Bearer <redacted token> User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/605.1 (KHTML, like Gecko) JavaFX/8.0 Safari/605.1 Referer: http://localhost:4200/authenticated/import-claims Accept-Encoding: gzip Accept-Language: en-us;q=0.8,en;q=0.7 Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryMqG4DL24VSS3By4F Content-Length: 21230 Host: localhost:4200 Connection: Keep-Alive ------WebKitFormBoundaryMqG4DL24VSS3By4F Content-Disposition: form-data; name="claimSpreadsheet"; filename="Mass Tort Upload Spreadsheet revised.xlsx" Content-Type: application/octet-stream PK... etc.
The only difference seems to be the Content-Type, as application/octet-stream
When I try to run the test from SoapUI Pro TestCase, I still get the error "An error occurred while processing your request.".
Question is, what am I setting up incorrectly in REST Method that causes the error? I'm certain this is a REST POST, and not a SOAP Request?