Hi Ok. It seems that if you use the File along wiht your own parameters (user = testUser) then you either need to a. use multipart/form-data b. Instead of using user=testUser as posted parameters , use this as part of the link itself i.e. in the queryString.
So using poster and say LiveHttpHeaders/ Fiddler capture whatever the browser sends and see which of the above you can use regards deepak On Tue, Aug 24, 2010 at 8:01 AM, Shelli Orton <[email protected]> wrote: > Hi, > > I'm not sure what you mean by "sample request for what works". I used > the "Poster" add-on for Firefox > (https://addons.mozilla.org/en-US/firefox/addon/2691/). By adding the > XML to the "Content to Send" field in that tool the requests are > successful. > > I did try adding the XML as a parameter value without a name set, but > the XML was not included in the request. It appears that a name is > mandatory for the parameter to be included in the request. And then as > a parameter, I still get back a 415 error since the webservice is > expecting XML in the content. > > Shelli > > -----Original Message----- > From: Deepak Shetty [mailto:[email protected]] > Sent: Monday, August 23, 2010 9:38 PM > To: JMeter Users List > Subject: Re: Include File in HTTP Post Request > > Hi > Do you have any sample request for what works ? > I dont think you should be using Send File (unless that is what your > service > expects). Typically the XML should be sent as part of body of a POST or > PUT. > In which case you need to specify the XML as the value field in Send > Parameter with request . Now if you only have a File , then you probably > will need to write some java code(Beanshell/BSF) to read it and set it > into > a variable. For now just to test you should just copy the XML as a > String > into the value field (you can leave name empty if your service does not > need > a name) and see if that works . > regards > deepak > > On Mon, Aug 23, 2010 at 3:27 PM, Shelli Orton <[email protected]> > wrote: > > > Hi, > > > > > > > > I'm writing a JMeter test to test a RESTful webservice I've written. > > The webservice POST methods both consume and produce "text/xml" > content > > type. In my test I have an HTTP Request with a "user" request > parameter > > and a file to send with the request containing the XML. I configured > > the file as: > > > > > > > > File Path: ./Resource.xml > > > > Parameter Name: <empty> > > > > MIME Type: text/xml > > > > > > > > The sampler request is as follows: > > > > > > > > Thread Name: Thread Group 1-1 > > > > Sample Start: 2010-08-23 16:12:34 MDT > > > > Load time: 3 > > > > Latency: 3 > > > > Size in bytes: 1129 > > > > Sample Count: 1 > > > > Error Count: 1 > > > > Response code: 415 > > > > Response message: Unsupported Media Type > > > > > > > > Response headers: > > > > HTTP/1.1 415 Unsupported Media Type > > > > X-Powered-By: Servlet/3.0 > > > > Server: GlassFish Server Open Source Edition 3.0.1 > > > > Content-Type: text/html > > > > Content-Length: 1129 > > > > Date: Mon, 23 Aug 2010 22:12:34 GMT > > > > > > > > HTTPSampleResult fields: > > > > ContentType: text/html > > > > DataEncoding: ISO-8859-1 > > > > > > > > As shown above, I get a 415 error. The request looks like this: > > > > > > > > POST http://localhost:8080/MyWebService/resource/ > > > > > > > > POST data: > > > > user=TestUser > > > > > > > > [no cookies] > > > > > > > > Request Headers: > > > > Content-Length: 13 > > > > Connection: keep-alive > > > > Content-Type: application/x-www-form-urlencoded > > > > > > > > The XML wasn't included, so, thinking that the issue was the relative > > path to the xml file, I changed it to an absolute path. However, I > > still get the same response. > > > > > > > > How should I configure the sampler to include the contents of the xml > > file? > > > > > > > > Thanks! > > > > > > > > Shelli > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >

