How to Post an XML in HTTP?

Software Benchmarks and Benchmarking: What is the way to use dynamic contents in XML using CSV file so that the XML can be send as HTTP Request in JMeter for RESTful service?

  • For more clarity on the question,  I need to send a XML to be processed by RESTful service using JMeter. The dynamic content of the XML is <OrderNumber>${__CSVRead(CO1.csv,0)}</OrderNumber> where  CSVRead() function used to get the N number of order number from CSV file. Use of JMeter and problem faced on it  are mention below: 1.       JMeter 2.9 version 2.       Thread Group used to simulate users. 3.       CSV file used for  CSV Data Set Config. 4.       HTTP Request Sampler used where the REST  URL  and file location which is used for send files With Request are assigned.     Issue: The dynamic variable is used in the Request file ( XML) and the variable is  not replaced runtime as mentioned in the CSV file. I need help how to pass the dynamic values in the Request XML while calling REST services. Thanks Abhijit

  • Answer:

    One solutions I can think of is: Generate XML along with any variables and put that in a variable with      vars.put("payLoad", xmlContent) after the Sampler ran. This should be written in the BeanShell post processor. Then, use this variable in the next sampler with variable name      `${payLoad}`. I have done this to generate dynamic JSON POST request, from both JSON and Binary Responses.

Kishan Krol at Quora Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.