Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JMeter - Trouble sending HTTP request with POST variable?

I am trying to load test a java servlet that fetches records from an archive database.

The servlet works as follows:

  • 1-Reads in post variables from HTTP header
  • 2-Uses variables to query database
  • 3-Returns XML

I have setup a test which I want to fire off HTTP requests with post variables however the test is not working, getting errors with J Meter.

Screenshot 1 - Shows the structure of the test enter image description here

Screenshot 2 - Shows the CSV file I am reading from enter image description here

I have placed the CSV file in the same folder that my test plan is saved in!

Screenshot 3 - Shows the HTTP request enter image description here

This is the error output:

Thread Name: Thread Group 1-1 Sample Start: 2012-11-20 10:35:27 GMT Load time: 0 Latency: 0 Size in bytes: 1113 Headers size in bytes: 0 Body size in bytes: 1113 Sample Count: 1 Error Count: 1 Response code: Non HTTP response code: java.net.URISyntaxException Response message: Non HTTP response message: Expected closing bracket for IPv6 address at index 13: http://[http://sophos1.testserver.co.uk/servlet/archive]:61061/

Response headers:

HTTPSampleResult fields: ContentType: DataEncoding: null

POST Request

POST http://[http://sophos1.testserver.co.uk/servlet/archive]:61061/

POST data:


[no cookies]

Returned DATA

java.net.URISyntaxException: Expected closing bracket for IPv6 address at index 13: http://[http://sophos1.testserver.co.uk/servlet/archive]:61061/
        at java.net.URI$Parser.fail(Unknown Source)
        at java.net.URI$Parser.failExpecting(Unknown Source)
        at java.net.URI$Parser.parseServer(Unknown Source)
        at java.net.URI$Parser.parseAuthority(Unknown Source)
        at java.net.URI$Parser.parseHierarchical(Unknown Source)
        at java.net.URI$Parser.parse(Unknown Source)
        at java.net.URI.<init>(Unknown Source)
        at java.net.URL.toURI(Unknown Source)
        at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:232)
        at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:62)
        at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1075)
        at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1064)
        at org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:426)
        at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:255)
        at java.lang.Thread.run(Unknown Source)

Please help!

Thanks

like image 990
tomaytotomato Avatar asked Nov 20 '12 10:11

tomaytotomato


1 Answers

Remove http:// from Server Name / IP field of your HTTP Request Sampler (that's pointed in HTTP Request fields description).

Look onto your generated POST request above in description:

POST Request
POST http://[http://sophos1.testserver.co.uk/servlet/archive]:61061/

Configure your HTTP Request as the following instead:

Server Name: sophos1.testserver.co.uk
Path: /servlet/archive
Implementation: Java
like image 100
Aliaksandr Belik Avatar answered Sep 22 '22 12:09

Aliaksandr Belik