Forum Discussion

smenon's avatar
smenon
Occasional Visitor
4 years ago

REST using SOAP to send file as an attachment.

Hello Everyone,

I am using SOAP UI 5.2.1 to  call REST  and the method used is post. How can I send an image as a request, image is in a file. I need to send the file as an attachment along with other fields. If there is any document explaining steps would be appreciated.

Thank you

Sam

  • PrathapR's avatar
    PrathapR
    Frequent Contributor

    Hey smenon 

     

    We can pass other fields as path or query parameters as you aware, coming to image, we have to send as attachment. For this please follow below steps:

     

     

    Step1: Click on Attachments (1 from above image)

    Step2: Click on Green + symbol, it will give you file explorer to navigate to image, please select image. Then it asks "Cache Attachment in request", say "Yes", so it will cache your image and reuse instead of pulling from directory every time we hit call.

    Note: Make Sure your image type should be jpg or jpeg. (Other types might work, but I had face issue earlier, so)

    and make sure should be ContentType: image/jpeg (below the no:2 in  above image), after you done attachment

    Step3: Change Media type to "multipart/form-data" (no:3 in  above image)

    Step4: Enable the Post QueryString option then send it.

    If you would like to get more info : https://support.smartbear.com/readyapi/docs/requests/attachment/rest.html

     

    Thanks!