0

Upload file using SOAP UI

Upload file using SOA UI

This article demonstrates how to upload file to a RESTful web service. Using SoapUI for testing web services may speed up development of an application since we do not need to wait for a working UI. We’ll use SoapUI OpenSource 5.2.1. This is a free version and can be downloaded from

http://www.soapui.org/downloads/soapui.html

Configure a Request

After you created a request, you may now configure it as shown on the image below. There are 5 items to take note of.

  1. The method
    You may specify either POST or PUT.
  2. Request Parameter Value
    When uploading a file instead, the text value needs to be in a specific format, i.e., file:<PATH_AND_FILE_NAME>
  3. Media Type
    This must be set to “multipart/form-data”
  4. Post QueryString
    This must be ticked
  5. Attachments
    You need to attached the file referred to by the Request Parameter Value (item 2). Take note of the “Cached” column. When you attach a file, SoapUI asks you whether or not to cache the file. If an attachment is cached, a copy of the original file is temporarily saved and sent everytime the request is sent to the RESTful web service.

turreta-soap-ui_0

Karl San Gabriel

Karl San Gabriel

Java and Enterprise Technologies Expert