Announcement Announcement Module
Collapse
No announcement yet.
MultiPartUpload: Cannot convert value of type [java.lang.String] to required type... Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • MultiPartUpload: Cannot convert value of type [java.lang.String] to required type...

    Hi, I want to test the MVC Fileupload with SOAPUI, here is the Request, SOAPUI generates:

    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--
    My Controller looks like:
    Code:
    	@RequestMapping(value = "/tempfile", method = RequestMethod.POST)
    	public void handleTempfileUpload(@RequestParam("uploadedFile") MultipartFile file, @RequestParam(value = "fileTypes", required = false) String fileTypes, HttpServletResponse response) {
    I get this error:
    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
    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...

    Cheers,

    Jan
Working...
X