how to post with attachment in REST
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2011
06:58 PM
01-03-2011
06:58 PM
how to post with attachment in REST
Hi,
I have problem with posting with attachment in REST.
I saw a doc for this http://www.soapui.org/SOAP-and-WSDL/add ... ments.html
But it is only for soap and I don't see any properties related to MTOM.
Our REST service doesn't have a WADL by the way.
I have problem with posting with attachment in REST.
I saw a doc for this http://www.soapui.org/SOAP-and-WSDL/add ... ments.html
But it is only for soap and I don't see any properties related to MTOM.
Our REST service doesn't have a WADL by the way.
7 REPLIES 7
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2011
01:38 AM
01-04-2011
01:38 AM
Hello,
In the Request window, you should have an Attachments tab near the bottom of the request part. If you open this tab, you should be able to add file attachments to your request. Make sure to select the media type: "multipart/form-data" in the dropdown menu for the request, and that the HTTP Method is set to POST.
Regards,
Dain
eviware.com
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
In the Request window, you should have an Attachments tab near the bottom of the request part. If you open this tab, you should be able to add file attachments to your request. Make sure to select the media type: "multipart/form-data" in the dropdown menu for the request, and that the HTTP Method is set to POST.
Regards,
Dain
eviware.com
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2011
01:00 AM
01-06-2011
01:00 AM
I saw a lot of garbage char, how to set the encoding?
POST http://www.ecg-api.kijiji.ca.staging.in ... i/pictures HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: multipart/form-data; boundary="----=_Part_3_16632831.1294304305637"
MIME-Version: 1.0
User-Agent: Jakarta Commons-HttpClient/3.1
Host: www.ecg-api.kijiji.ca.staging.intern.qa-kijiji.com
Content-Length: 45849
------=_Part_3_16632831.1294304305637
Content-Type: application/octet-stream; name="API output list.xls"
Content-Transfer-Encoding: binary
Content-Disposition: form-data; name="API output list.xls"; filename="API output list.xls"
ÐÏ à¡± á
POST http://www.ecg-api.kijiji.ca.staging.in ... i/pictures HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: multipart/form-data; boundary="----=_Part_3_16632831.1294304305637"
MIME-Version: 1.0
User-Agent: Jakarta Commons-HttpClient/3.1
Host: www.ecg-api.kijiji.ca.staging.intern.qa-kijiji.com
Content-Length: 45849
------=_Part_3_16632831.1294304305637
Content-Type: application/octet-stream; name="API output list.xls"
Content-Transfer-Encoding: binary
Content-Disposition: form-data; name="API output list.xls"; filename="API output list.xls"
ÐÏ à¡± á
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2011
06:25 PM
01-06-2011
06:25 PM
By the way, what's the different for curl -F @file=bla.jpg to add the file in the attachment ?
in the raw part, I see the attached image is encoded into a lot of chars but it is not actually accepted by my REST service.
Can any of you give me a hand on any of the question I raised?
It seems none of them is solved...
in the raw part, I see the attached image is encoded into a lot of chars but it is not actually accepted by my REST service.
Can any of you give me a hand on any of the question I raised?
It seems none of them is solved...
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2011
02:22 AM
01-07-2011
02:22 AM
Hello,
I cannot tell you why your server is rejecting the file, since I do not know what it is expecting to receive. You are not using a known standard, and neither I nor the soapUI software will be able to tell you how to create the request you are after without knowing what it is you actually want to send. The curl command you have given (I assume you mean "curl -F file=@bla.jpg") sends a file much in the same was that soapUI does when the content type is correctly set as multipart/form-data. Since this is form data we're talking about, each form field has both a name and a value. I'm just guessing here, but perhaps your server isn't accepting the file because it is expecting it to have a different form field name? The curl command you're using (again, assuming "curl -F file=@bla.jpg") sets the form field name to "file". By default soapUI sets this name to whatever the file name is, but it's easily changed by changing the "ContentID" field for the attachment in soapUI. If this isn't working, I can't help you without an exact specification of what your server actually accepts.
Regards,
Dain
eviware.com
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
I cannot tell you why your server is rejecting the file, since I do not know what it is expecting to receive. You are not using a known standard, and neither I nor the soapUI software will be able to tell you how to create the request you are after without knowing what it is you actually want to send. The curl command you have given (I assume you mean "curl -F file=@bla.jpg") sends a file much in the same was that soapUI does when the content type is correctly set as multipart/form-data. Since this is form data we're talking about, each form field has both a name and a value. I'm just guessing here, but perhaps your server isn't accepting the file because it is expecting it to have a different form field name? The curl command you're using (again, assuming "curl -F file=@bla.jpg") sets the form field name to "file". By default soapUI sets this name to whatever the file name is, but it's easily changed by changing the "ContentID" field for the attachment in soapUI. If this isn't working, I can't help you without an exact specification of what your server actually accepts.
Regards,
Dain
eviware.com
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2011
08:09 PM
01-09-2011
08:09 PM
Hi,
thanks for the reply!
But how can I change the contentID?
I think it is read only?
thanks for the reply!
But how can I change the contentID?
I think it is read only?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2011
08:43 PM
01-09-2011
08:43 PM
Hi,
I've figured out the solution to this issue.
Thank you so much.
I've figured out the solution to this issue.
Thank you so much.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2017
06:14 AM
04-26-2017
06:14 AM
Hi CXin
Encountered same error and already exhaust scenarios that I can experiment with.
I'm hoping you could share how you were able to solve this please.
Thank you.
