Ask a Question

how to read a single request from multiple requests in a xml file

Naveen87
Occasional Contributor

how to read a single request from multiple requests in a xml file

Hi All, 

 

I am using SOAP 5.1.2 and below is my requirement

I have an property file, where data will be dynamically changed and XML file with multiple requests

 

Here, I have an property file as below

<email.id>xyz@gmail.com</email>

<pwd.pd>xyzadf</pwd>

 

and xml with multiple requests as below

<tc1>

    <payload>email=${email.id}&pwd=${pwd.pd}</payload>

</tc1>

 

<tc2>

       <payload>email=${email.id}&pwd=${pwd.pd}</payload>

</tc2>

 

the email and pwd filed in xml file will changed based the value assigned in property file which will be manually given.

 

can anyone help me on how to read the value in property file(which will be a local file) and set in xml file and how to access the request from multiple request. I have to access a particular request like tc1 and tc2 for teststep

 

 

 

 

 

 

 

4 REPLIES 4
nmrao
Community Hero

Re: how to read a single request from multiple requests in a xml file

If you are SoapUI NG /Pro user then I believe you can achieve this using DataSource


Regards,
Rao.
Naveen87
Occasional Contributor

Re: how to read a single request from multiple requests in a xml file

Hi, 

 

I am not using PRO version, am using normal version. Is there any way to achieve this in normal version. 

 

Thanks.

Atanoly
Occasional Contributor

Re: how to read a single request from multiple requests in a xml file

Hi.

 

I would change your initial file with data to .csv file and then did the follwing

f = new File("C:\\folder1\\folder2\\propertyFile.csv")
BufferedReader br = new BufferedReader(new FileReader(f)) 
String line;
int j = 1
while ((line = br.readLine()) != null)
{
       	log.info "++++++++++ ++++++++++ ++++++++++ - $j - ++++++++++ ++++++++++ ++++++++++"
       	String [] array =  line.split(";")
       	emailAddress= array[0]
       	password = array[1]
        	yourFunction(emailAddress,password)	
       	j = j + 1	
}

// where yourFunction is the function that you need to create that updates your request with email / password and runs it.

how to update and run your requests look here :

 

http://www.soapui.org/scripting---properties/tips---tricks.html#1-1-get-and-set-properties

 

 

 

nmrao
Community Hero

Re: how to read a single request from multiple requests in a xml file

You can do the same in Open Source edition too. Check the link https://learnsoapui.wordpress.com/2012/05/19/groovy-datasource-teststep-dataloop-teststep-using-groo...


Regards,
Rao.
cancel
Showing results for 
Search instead for 
Did you mean: