I have resolved it this way. 1. Set Content-Type As application/xml in HTTP Header Manager 2. Read xml file from a file. 3. Post the file as SOAP/XML-RPC Request.
I have posted a sample file.. here http://www.mediafire.com/file/s61oo2v2mfgx52n/RestTesting.jmx On Tue, 24 Aug 2010 08:40:24 -0600, "Shelli Orton" <[email protected]> wrote: > Oh, I meant to include that I did briefly look at the SOAP/XML-RPC > Request, but since my webservice is REST and not SOAP I thought the other > route (using HTTP Request sampler) was the more appropriate one. > > Shelli > > -----Original Message----- > From: Shelli Orton > Sent: Tuesday, August 24, 2010 8:38 AM > To: JMeter Users List > Subject: RE: Include File in HTTP Post Request > > Hi, > > Thanks to all for the replies. > > The first way of doing this that Sebb quoted is what I was attempting to > do. However, it doesn't seem to read the file. Based on my original > message which details how I set it up, does anyone see a mistake? > > Thanks again! > > Shelli > > -----Original Message----- > From: sebb [mailto:[email protected]] > Sent: Tuesday, August 24, 2010 4:50 AM > To: JMeter Users List > Subject: Re: Include File in HTTP Post Request > > On 24 August 2010 04:37, Deepak Shetty <[email protected]> wrote: >> 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. > > Not necessary, see the description of the Filepath attribute under: > http://jakarta.apache.org/jmeter/usermanual/component_reference.html#HTTP_Request > > "If it is a POST or PUT request and there is a single file whose > 'name' attribute (below) is omitted, then the file is sent as the > entire body of the request, i.e. no wrappers are added. This allows > arbitrary bodies to be sent. This functionality is present for POST > requests after version 2.2, and also for PUT requests after version > 2.3." > > Or you may find it easier to use: > http://jakarta.apache.org/jmeter/usermanual/component_reference.html#SOAP/XML-RPC_Request > >> 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] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

