Hi All,

I am using apache commons httpClient PostMethod in conjunction with
MultipartRequestEntity to upload a file.
I am getting a 500 status code and when I print the Response Body I see the
following error:
" javax.ws.rs.WebApplicationException:
org.jvnet.mimepull.MIMEParsingException: Missing start boundary
    at
com.sun.jersey.multipart.impl.MultiPartReader.readFrom(MultiPartReader.java:203)
....
"

Can anyone provide any pointers on why this is cause?

Here is how my code looks like:
            HttpClient client = new HttpClient();
            PostMethod method = new PostMethod(url);
           method.addRequestHeader("Content-Type", "multipart/form-data");
           method.addParameter("name", "somename here");

        try {
            Part[] parts = {
                    new StringPart("file","workflow.xml"),
                    new FilePart(targetFile.getName(), targetFile ,
"application/octet-stream","") };
            method.setRequestEntity(new MultipartRequestEntity(parts,
method.getParams()));

            } catch (FileNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
int statusCode = client.executeMethod(method);



Thanks
Sunitha

Reply via email to