I have a problem emulating a Http request in JMeter.
The basic task is to make JMeter emulate a request made in firefox, and then use that as the basis of a performance test. However, i am having problems getting JMeter to include the post-header body.
Using fiddler, i recorded the request from firefox, which looks something like this.
POST http://*****:8001/XMLServlet?action=send HTTP/1.1
Host: *****
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20100101 Firefox/17.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Referer: http://*****:8001/XMLServlet
Cookie: JSESSIONID=YpvCQGvFWshb6yyNsZvWZzHLLknNMpXRJ36vR7p0jxSp41Q3zlbj!-409403047
Content-Type: multipart/form-data; boundary=---------------------------491299511942
Content-Length: 3125
-----------------------------491299511942
Content-Disposition: form-data; name="find"; filename="2010100010427.XML"
Content-Type: text/xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE DDT PUBLIC "*****" "*****">
<Some XML file/>
-----------------------------491299511942
Content-Disposition: form-data; name="submit"
Send
-----------------------------491299511942--
I made a login request in JMeter which works fine, but the actual post isn't behaving as expected.
I am using the "Send file with request" option to send the file, i have chosen the POST method, and in Post Body(raw) i have added
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Host: *****
Connection: keep-alive
Referer: http://*****:8001/XMLServlet
I would expect this to be included in the final request, but when i look at fiddler after executing fiddler, this is the result:
POST http://*****:8001/XMLServlet?action=send HTTP/1.1
Connection: keep-alive
Cookie: JSESSIONID=LdyTQGsGzg0bSvbTKhF3grPhBYTKnY2TJ3CzLdB3Fwp8K7r2z2zN!-409403047
Content-Length: 2034
Content-Type: multipart/form-data; boundary=_bm2tmf-3Nv071ZvyhFKaWOc4RixWE_dNyLk
Host: *****:8001
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.2.1 (java 1.5)
--_bm2tmf-3Nv071ZvyhFKaWOc4RixWE_dNyLk
Content-Disposition: form-data; name="find"; filename="2010100000484.XML"
Content-Type: text/xml
Content-Transfer-Encoding: binary
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE DDT PUBLIC "*****" "http://*****/sad.dtd">
<Some XML file/>
--_bm2tmf-3Nv071ZvyhFKaWOc4RixWE_dNyLk--
Why is JMeter ignoring the Post Body? And more importantly: How do i fix it?
What you added to POST body are HTTP headers, not body. Headers can't be setupped in HTTP Request sampler. To send them, you should add HTTP Header Manager with all those headers.