Hi, I want to test the MVC Fileupload with SOAPUI, here is the Request, SOAPUI generates:
My Controller looks like:Code:POST http://localhost:8080/service/tempfile/ HTTP/1.1 Accept-Encoding: gzip,deflate Content-Type: multipart/form-data; boundary="----=_Part_21_965680888.1263806629989" MIME-Version: 1.0 User-Agent: Jakarta Commons-HttpClient/3.1 Host: localhost:8080 Content-Length: 1489 ------=_Part_21_965680888.1263806629989 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: form-data; name="filename" Foo ------=_Part_21_965680888.1263806629989 Content-Type: application/octet-stream Content-Transfer-Encoding: binary Content-Disposition: form-data; name="uploadedFile" <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <html [...snip'n'snap...] </html> ------=_Part_21_965680888.1263806629989--
I get this error:Code:@RequestMapping(value = "/tempfile", method = RequestMethod.POST) public void handleTempfileUpload(@RequestParam("uploadedFile") MultipartFile file, @RequestParam(value = "fileTypes", required = false) String fileTypes, HttpServletResponse response) {
It works well with a default html form. I guess SOAPUI handles the upload a bit different. Can I fix it on the java side? I'd really like to have a testcase for the upload...Code:HTTP/1.1 400 Bad Request Content-Type: text/plain; charset=iso-8859-1 Content-Length: 215 Server: Jetty(6.1.21) You input data is incorrect: IllegalStateException Cannot convert value of type [java.lang.String] to required type [org.springframework.web.multipart.MultipartFile]: no matching editors or conversion strategy found
Cheers,
Jan


Reply With Quote
