You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by "Stover, Michael" <Mi...@usa.xerox.com> on 2002/03/20 16:25:05 UTC

RE: problem for uploading file

I'd respond to the user list, but the user list isn't accepting my emails.  

I see two problems. 

1. You didn't include the argument "action=MetricRequestURL".  Maybe this is
just a typo in your email
2. Bigger problem is that your web application is expecting the URL to
contain the arguments GET-style, whereas JMeter is sending them as multipart
form-data, which means you have to use different methods to extract the
arguments from the Request.  If you are using a servlet engine, for example,
then the following call won't work:

HttpServletRequest.getParameter("type");

The default HttpServletRequest that comes with sun's servlet package doesn't
parse multipart messages.  For that, you need to translate it into
O'Reilly's MultipartRequest object (there are others too), and then call
"getParameter()" on that object.

-Mike

> -----Original Message-----
> From: Hongfei Cheng [mailto:hongfei.cheng@sitraka.com]
> Sent: Wednesday, March 20, 2002 10:02 AM
> To: jmeter-user@jakarta.apache.org
> Subject: problem for uploading file
> 
> 
> Hi,
> 
> I am using Jmeter 1.7 for testing a webserver. I tried to 
> upload a file
> and form content to a servlet,
> the Html file looks like:
> 
> **********************************************
> <form target="output" method="POST"
> action="http://localhost:2002/?type=0&action=MetricRequestURL"
> enctype="multipart/form-data">
> <input type="file" name="xmlcontent">
> <input target="output" type="submit" value="Submit">
> </form>
> **********************************************
> 
> what I did with jmeter:
> 1.start jmeter by run jmeter.bat
> 2.add a new ThreadGroup to Test
> plan
> 3. add a new Http Request to my ThreadGroup,then config the 
> Http Request
> as
>         set ServerName or IP:    localhost
>         set Port Number:             2002
>              Protocol:                    HTTP
>               Method:                    POST
>               send parameters with the request:
>                     Name     value
>                     type        0
>               send a file with the request:
>                     Filename: the file's absolute path
>                     ParameterName: xmlcontent
>                     MIME Type: text/xml
> 
> when run the test, I got a IOException for the 400 respond code,
> 
> URL = http://localhost:2002/
> java.io.IOException
>         at
> org.apache.jmeter.protocol.http.sampler.HTTPSampler.sample(HTTPSample
> r.java:464)
>         at
> org.apache.jmeter.protocol.http.sampler.HTTPSampler.sample(HTTPSample
> r.java:164)
>         at
> org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:138)
>         at java.lang.Thread.run(Unknown Source)
> 
> do I use the correct controller, or if you can upload a file
> successfully, please let me know your steps, thanks for your help
> 
> Hongfei
> 
> 
> --
> To unsubscribe, e-mail:   
> <ma...@jakarta.apache.org>
> For additional commands, e-mail: 
> <ma...@jakarta.apache.org>
> 

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>