Forum Discussion

CXin's avatar
CXin
Frequent Contributor
16 years ago

How to post with image or attachment

Hi Support team,

In my case, I want to post a request with an image.
Usually, I have to use Html to do it:

<HTML>
<head>
<title>title</title>
</head>
<BODY>
<form action="http://api.kijiji.ca/c-ClassiApiCommand" name = "api"method="post" enctype="multipart/form-data" >
<TEXTAREA name = "xml" cols="120" rows="20">
<?xml version="1.0" encoding="utf-8" ?>
<SOAP:Envelope xmlns:SOAP="http://www.w3.org/2003/05/soap-envelope">
<SOAP:Header>header info here</SOAP:Header>
<SOAP:Body>body info here</SOAP:Body>
</SOAP:Envelope>
</TEXTAREA>
Select an 120x60 (SnB logo) Image:<input type = "file" name = "Body/snb120x60" />
<input type = "submit" name = "submit" value= "submit" />
</form>
</body>
</html>

I want to how to do the bold part in SoapUI pro?

15 Replies

  • Hello,

    The ContentID should correspond to the name of the file field, in this case, "Body/image4" (without the quotes) is what you're after.

    Regards,
    Dain
    eviware.com
  • CXin's avatar
    CXin
    Frequent Contributor
    So, according to you, the contentID is the same as the attachment name i uploaded?

    As you know, slash / is not allowed for file name.
    so there is no way for me to change its contentID to Body/image1
  • CXin's avatar
    CXin
    Frequent Contributor
    Hi,

    I am still hanged on this issue.
    Can you help?
  • Hi!

    to attach a file in a simulated form you need to:

    1) Add the file as an attachment
    2) Set the parameter value to "file:<name of attachment>"
    3) Set the media-type of the request body to "multipart/form-data" (available in the dropdown)
    4) Select the "Post QueryString" checkbox

    I've attached a screenshot also, hope this helps!

    regards,

    /Ole
    eviware.com