Forum Discussion

rocketboy2000's avatar
12 years ago

assistance with REST file upload

wondering if anyone can help me figure out what i am doing wrong re a REST call to upload a file.

works in curl but not in soapui.

my request looks something like this:

POST http://weblogic.strategicfunctions.ca/r ... /documents HTTP/1.1
Accept-Encoding: gzip,deflate
ACCEPT: application/json
Content-Type: multipart/form-data; boundary="----=_Part_14_1473216977.1394230151871"
MIME-Version: 1.0
Authorization: Basic dGFudGFsaXNDbGllbnQ6cGFzc3dvcmQ=
Content-Length: 24831
Host: weblogic.strategicfunctions.ca
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

but i get a repsonse:

TTP/1.1 400 Bad Request
Date: Fri, 07 Mar 2014 22:09:12 GMT
Content-Length: 129
Content-Type: application/json
X-Powered-By: Servlet/2.5 JSP/2.1
Set-Cookie: JSESSIONID=XtR3ThDL83RZThHGGYQ65xL10fDP3fvp2KypCxsTMy1gpZJ6SQdC!942666606; path=/; HttpOnly
Connection: close

{"errors":[{"message":"File is required.","messageTemplate":"{doc.file.required}","invalidValue":null,"path":"uploadData.arg2"}]}

the correct curl request/response is:

> POST /rest/application/v1/documents HTTP/1.1
> User-Agent: curl/7.33.0
> Host: weblogic.strategicfunctions.ca
> Accept: */*
> Authorization:Basic dGFudGFsaXNDbGllbnQ6cGFzc3dvcmQ=
> X-AUTH-TANTALIS-CLIENT-APP:EAS
> X-AUTH-TANTALIS-CLIENT-USER:WNEVILLE
> Content-Length: 24777
> Expect: 100-continue
> Content-Type: multipart/form-data; boundary=------------------------88d4ad2bca782400
>
< HTTP/1.1 100 Continue
< HTTP/1.1 100 Continue
< HTTP/1.1 201 Created
< Date: Fri, 07 Mar 2014 23:27:57 GMT
< Location: http://weblogic.strategicfunctions.ca/r ... 570368.xls
< Content-Length: 90
< Content-Type: application/json
< ETag: "44a2d7051b820f602a810e3e545b3b99"
< X-Powered-By: Servlet/2.5 JSP/2.1
< Set-Cookie: JSESSIONID=0TyGThVd8PK7GMRkTp55vhRv0YvTpHJfQntXcThwqHVYS8v5Js8h!942666606; path=/; HttpOnly

thanks in advance.