JMeter - Trouble sending HTTP request with POST variable?

jmeter http request
jmeter post body from file
jmeter dynamic request body
how to send multiple json request in jmeter
jmeter json extractor
jmeter post processor
jmeter csv data set config
jmeter http request timeout default

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

Screenshot 2 - Shows the CSV file I am reading from

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

Screenshot 3 - Shows the HTTP request

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

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

Sending HTTP and HTTPS Requests Using Groovy in , Get more from your JMeter HTTP/S Requests by writing them in Groovy. This tutorial will Sending an HTTP / HTTPS POST Request in Groovy. In order to new Gson().toJson(body) - converting the value of the variable "body" to JSON format. If you are a moderator please see our troubleshooting guide. Trouble sending HTTP request with POST variable Hello, 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

The easy way is that you could leave the server name blank and set the path to

http://sophos1.testserver.co.uk/servlet/archive

Trouble sending HTTP request with POST variable, Hello, 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� Instead it only shows null under request body. Testing with postman works and running jmeter with maven command also works. Running Jmeter pointing to my local server also works. On my colleagues computer also fine. But if I made http request to remote server using my computer, it only shows null request. screenshot to remote server

Check if there are any spaces in ServerName or IP field.

This gave me this error :

Response message: Non HTTP response message: Illegal character in authority at index 7:

When extra spaces were trimmed in the beginning, it worked well.

Sending HTTP and HTTPS Requests Using Groovy in , Map<String,Object> body - body POST request. The request body will be passed as a variable with the data type Map <String, Object>. Map is a� A tutorial on how to deal with a changing number of parameters and HTTP requests using the open source Apache JMeter tool in order to keep your app performant.

JMeter 5.0: How to send HTTP Request with body data?, The problem was in the configuration o JMeter. I was using the Parameters tab of HTTP request and putting properties on the Name tab and� HTTP GET is passing parameters in query string and HTTP Post is passing them in request body. Your test case should explicitly distinguish HTTP request type basing on use case. In some cases same endpoint (URL) can accept different requests ( GET, POST, PUT, DELETE, HEAD, etc. ) but the application behavior and results will be different.

JMeter - Post Data passes JSON data, This application passes a JSON data for sending a request so in Body Parameter tab I see JSON type data. So, added JSON Post Extractor for one HTTP request� Hi list! Encountered a problem with JMeter (v2.3.4) that I cannot find a workaround for. Hoping someone has a suggestion I've overlooked. I have a complicated HTTP POST request (70+ parameters, with a number of variable substitutions).

API Testing with JMeter, This article explains you how to use Apache JMeter for automated API testing by 1.1 Write a small JS script to get a token or key from the request: To send requests to the server with parameters, add functions and variables as well as a browser. The Use multipart/form data for POST checkbox may be unchecked. HTTP Request Response Headers Tutorial In Detail JMeter Pre & Post Processors - JMeter Tutorial 14 - Duration: 10:40. HelpingTesters 4,723 views. 10:40. 11th JMeter Training Video

Comments
  • Thanks, so what is the difference between JAVA, HTTP3.1 and HTTP4 . Should I always use JAVA to be safe?
  • Its working now, however In the POST header its coming up as POST data: customerid=${id}
  • 1. Look into HTTP Request description - there are details for each implementation type with limitations mentioned. Using Java implementation is not the rule, but usage of HTTP4 can cause memory leak issue in case of load-test scenario.
  • Thanks, I figured out the post variable problem, it seems variables are case sensitive. I was using "id" instead of "ID"!
  • 2. You mean that the ${id} is not expanded into corresponding value from csv upon sending request? If so then ensure that your CSV Data Set Config correctly extracts values from your csv-file into ${ID}.
  • it's working with your solution but it's weird. We should be giving the IP on proper place. Same issue I have been seeing using Load runner