On Wed, 2010-01-06 at 16:41 -0800, sunitha yellasinganamala wrote:
> 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?
>
For your own good consider upgrading to HttpClient 4.0.1 HttpClient 3.x
is nearing end of life. I, for one, have no interest supporting it
anymore.
Oleg
> 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
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]