Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

testing - soapUI: multipart/form-data REST request with file attachments

I am using soapUI for testing a REST web service. Is there a way to attach a file with the other parameters in a multipart request? I see the attachment tab in the panel but I cannot give that attachment a parameter name so that server can identify. It's not helping.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I found it but forgot to post it here. It was not so intuitive.

  1. In your REST Request if you can see an attachment tab, open it and add and attachment with + button. The Name of that file would show full path. e.g. C:empmy-file.csv
  2. In you parameters tab, add a parameter and give it a name. The value of that parameter will be file:C:empmy-file.csv
  3. In SoapUI 5.x and greater, you must select the "Post QueryString" checkbox. Without this, the file will not be send along with the request.

That should be it. When attaching a file if you select Yes when it asks to Cache the file, you won't have to specify full path in step 2 above. The value of file parameter should be file:my-file.csv


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...