jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mwolfe38 <mwolf...@gmail.com>
Subject How to have both text/xml POST data and a file in multipart HTTP Request sampler
Date Sat, 07 Nov 2009 10:08:14 GMT

I am trying to simulate some communication that occurs with a device
communicating over http using curl  and an http server.
THe requests are slightly more complex than your typical webform though.
For instance, I have the following data being sent up in a post
enctype:application/x-www-form-urlencoded
path:/index.aspx?some=querystring&here=1
post: (with no name parameter, content type:text/xml)
<xml><data>${here}</data></xml>

The other scenario is that I can have the same as the above
enctype:multipart/form-data
path:/index.aspx?some=querystring&here=1
post: (with no name parameter, content type:text/xml)
<xml><data>${here}</data></xml>

file:<some file data> (content type whatever -- but this needs to vary)

Also note that I need the ability to replace variables in the post data
section.

It looks like i'm going to have to write my own sampler (or extend the
functionality of the current HTTP Request Sampler (or HTTP Request Client
Sampler).

I was able to figure out the first scenario and do variable replacement. It
was a bit tricky though, 
I had to put in the xml in a form field with no name parameter, then add a
config element -> HTTP Header Manager and add a field named content-type
with a value of text/xml
and then the post data would be sent up with a content type of text/xml
(putting content encoding of text/xml in the main gui for the HTTP Request
Sampler would give me an error).

The problem is that in the scenario when I want to send up a file as well,
it seems the xml data no longer uses the content type defined in the HTTP
Header Manager as it does when the form is  x-www-form-urlencoded.

Any ideas?
I'm working right now on a new sampler that will do exactly what I want in
these scenarios.

I'm also pondering the idea of modifying the current sampler
gui/implementation to treat the scenario where you have a single post field
of data differently than when you are dealing with a form. For instance, a
radio button could switch the GUI to show a large textarea rather than
having a name/value pair on a single line (which is a pain to edit for long
requests).
This could also alow the user to specify the content type of the data
easier.. 
I know that its also possible to send up the post data in a file with no
parameter, however I need to do variable replacement which isn't possible
from files.

If anyone has any ideas/suggestions, let me know
-- 
View this message in context: http://old.nabble.com/How-to-have-both-text-xml-POST-data-and-a-file-in-multipart-HTTP-Request-sampler-tp26240896p26240896.html
Sent from the JMeter - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Mime
View raw message