rodgersh
12 years agoOccasional Contributor
How to POST multipart/form-data with soapui 4.0.1 (free)
I am trying to POST a multipart/form-data with 2 form-data parts. The first part is a String, name="directive" and value="STORE_AND_PROCESS". The second part is the contents of a file (as opposed to a file attachment).
So the POST request looks like this:
***************************************************
POST http://172.18.14.169:8181/services/content/ HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: multipart/form-data; boundary="----=_Part_1_1530692737.1361832805105"
MIME-Version: 1.0
User-Agent: Jakarta Commons-HttpClient/3.1
Host: 172.18.14.169:8181
Content-Length: 10042
------=_Part_1_1530692737.1361832805105
Content-Type: multipart/form-data
Content-Transfer-Encoding: 8bit
----=_Part_0_514145621.1361832485399
Content-Disposition: form-data; name="directive"
STORE_AND_PROCESS
----=_Part_0_514145621.1361832485399
Content-Disposition: form-data; name="file"; filename="C:\path\to\myfile.json"
Content-Type: application/json
{ "properties":{ "title": "myTitle" } }
*****************************************************
I entered the parts into the text area beneath the Media Type drop down (which I set to multipart/form-data). I do not have a Form tab on the REST Test Request screen (is this a soapui Pro feature only?), hence the reason I entered all of this text by hand into this text area.
My REST service is failing to process this request, possibly because the boundary is assigned by soapUI when I send the request and is different than the boundary I entered into the text area.
So how do I send a multipart/form-data POST request using soapUI 4.0.1 free version? (I am on Windows 7).
Thanks.
So the POST request looks like this:
***************************************************
POST http://172.18.14.169:8181/services/content/ HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: multipart/form-data; boundary="----=_Part_1_1530692737.1361832805105"
MIME-Version: 1.0
User-Agent: Jakarta Commons-HttpClient/3.1
Host: 172.18.14.169:8181
Content-Length: 10042
------=_Part_1_1530692737.1361832805105
Content-Type: multipart/form-data
Content-Transfer-Encoding: 8bit
----=_Part_0_514145621.1361832485399
Content-Disposition: form-data; name="directive"
STORE_AND_PROCESS
----=_Part_0_514145621.1361832485399
Content-Disposition: form-data; name="file"; filename="C:\path\to\myfile.json"
Content-Type: application/json
{ "properties":{ "title": "myTitle" } }
*****************************************************
I entered the parts into the text area beneath the Media Type drop down (which I set to multipart/form-data). I do not have a Form tab on the REST Test Request screen (is this a soapui Pro feature only?), hence the reason I entered all of this text by hand into this text area.
My REST service is failing to process this request, possibly because the boundary is assigned by soapUI when I send the request and is different than the boundary I entered into the text area.
So how do I send a multipart/form-data POST request using soapUI 4.0.1 free version? (I am on Windows 7).
Thanks.