Forum Discussion

keshav's avatar
15 years ago

How to attach a file when using multipart/mixed using

I need to test a POST using REST service. The post consists of posting a File and metadata. It will be a multipart/mixed request. I am not able to send a request to POST the attachment. The request reaches to the server does not have attachment information, it only has metadata information and POST fails. How can I simulate this POST?
The header I have is as below :

Content-Type: multipart/mixed; boundary=xyz-multipart-boundary
Content-Length: 1039876
Host: localhost:8080
Connection: Keep-Alive

The part for Metadata should be
--xyz-multipart-boundary
Content-Disposition: form-data; name="Metadata"
{JSON METADAT INFORMATION}

--xyz-multipart-boundary
Content-Disposition: form-data; name="Content"; filename="SpringGraduateList09.doc"
Content-Type: application/octet-stream; name=SpringGraduateList09.doc
from here onwards, binary values and content of the file.

The above headers were captured by using Fiddler when running some java code to test with (It was done by one of the developer and provided me the header and content information)

I tried to simulate this using SOAPUI and I am not able to do so.
Any suggestions would be appreciated.

Thank You !!

1 Reply

  • ViktorHaag's avatar
    ViktorHaag
    New Contributor
    I also am attempting something very similar to this. I need to send a multipart/mixed POST with two parts: binary object meta-data (content-type application/json), followed by the binary object data itself (content-type dependent upon the file: image, document, whatever).

    There seems another similar post on this topic, with no response. Does this mean that SoapUI can't do this?

    Thanks.