how to import xmls and save responses
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2012
08:27 AM
11-21-2012
08:27 AM
how to import xmls and save responses
Hi guys,
my client is using soap UI, not soapUI pro. There are hundreds of XMLs which i have to load them into Soap UI and execute those requests(API testing). Can some one pls let me know how to import all/chunks of xmls at a time without copying and pasting each one at a time?
And also once i run a request(execute an xml request from the test suite) and get the resonse back, how can i save those responses?
I could not find any options for these two things in SOAP UI.
Your help is much appreciated.
Thanks,
Sarath
my client is using soap UI, not soapUI pro. There are hundreds of XMLs which i have to load them into Soap UI and execute those requests(API testing). Can some one pls let me know how to import all/chunks of xmls at a time without copying and pasting each one at a time?
And also once i run a request(execute an xml request from the test suite) and get the resonse back, how can i save those responses?
I could not find any options for these two things in SOAP UI.
Your help is much appreciated.
Thanks,
Sarath
7 REPLIES 7
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2012
01:25 AM
11-22-2012
01:25 AM
Come on guys, any help would be much appreciated. Copying and pasting XMLs one by one from Altova XML spy to Soap UI is not easy at all.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2012
01:16 AM
11-23-2012
01:16 AM
Sarath,
1.I have not yet done, but there could be a "package" that you can create in what ever the tool you are having your XML in. Soapui can import the packages.Please share, in case you are able to do so.
2.You can Save the response using the below:Create a groovy script with the below code.
def myOutFile = "D:/outfiles/response.xml"
def response = context.expand( '${Scriptname#Response}' )
def f = new File(myOutFile)
f.write(response, "UTF-8")
Note:script name is your script name.
Gurpreet
1.I have not yet done, but there could be a "package" that you can create in what ever the tool you are having your XML in. Soapui can import the packages.Please share, in case you are able to do so.
2.You can Save the response using the below:Create a groovy script with the below code.
def myOutFile = "D:/outfiles/response.xml"
def response = context.expand( '${Scriptname#Response}' )
def f = new File(myOutFile)
f.write(response, "UTF-8")
Note:script name is your script name.
Gurpreet
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2012
06:56 AM
11-23-2012
06:56 AM
You have to use Groovy scripts to do this in SoapUI free version. Get a list of file names then submit contents of each file in the request step.
First Groovy step to get list of files:
Followed by request step with this in the body:
Followed by another Groovy step to remove the file from the list, write the response to a file and loop back to the request as long as there are more files:
First Groovy step to get list of files:
def fileList = []
new File("C:\\requests").eachFile { f ->
if (f.isFile() && f.name.endsWith('.xml')) {
def filename = f.name[0..-5]
fileList.add(filename)
}
}
if (fileList.size() < 1) {
testRunner.fail("No request files")
}
context.put('fileList', fileList)
Followed by request step with this in the body:
${=new File("C:\\requests\\" + (context.get('fileList')).last() +".xml").text}
Followed by another Groovy step to remove the file from the list, write the response to a file and loop back to the request as long as there are more files:
def fileList = context.get('fileList')
def fileName = fileList.pop()
def response = context.expand( '${Test Request#Response}' )
def f = new File("C:\\responses\\${fileName}_Response.xml")
f.write(response, "UTF-8")
if (fileList.size() > 0) {
testRunner.gotoStepByName('Test Request')
}
"Ignorance more frequently begets confidence than does knowledge"
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2012
08:15 PM
11-28-2012
08:15 PM
M McDonald, very well explained.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2013
03:27 AM
03-08-2013
03:27 AM
Hi,
how to add the request step script you mentioned.....just pasting the given script doesnt work...
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cal="http://www.parasoft.com/wsdl/calculator/">
<soapenv:Header/>
<soapenv:Body>
<cal:add>
<cal:x>?</cal:x>
<cal:y>?</cal:y>
</cal:add>
</soapenv:Body>
</soapenv:Envelope>
This is my actual xml request which i need to fetch....
how to add the request step script you mentioned.....just pasting the given script doesnt work...
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cal="http://www.parasoft.com/wsdl/calculator/">
<soapenv:Header/>
<soapenv:Body>
<cal:add>
<cal:x>?</cal:x>
<cal:y>?</cal:y>
</cal:add>
</soapenv:Body>
</soapenv:Envelope>
This is my actual xml request which i need to fetch....
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2013
04:29 AM
03-08-2013
04:29 AM
hi,
how to run this script in the request test step..
..please let me knw
${=new File("C:\\requests\\" + (context.get('fileList')).last() +".xml").text}
how to run this script in the request test step..
..please let me knw
${=new File("C:\\requests\\" + (context.get('fileList')).last() +".xml").text}
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2019
12:51 AM
08-15-2019
12:51 AM
@Ashik wrote:
Hi,
how to add the request step script you mentioned.....just pasting the given script doesnt work...
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/essaytyper" xmlns:cal="http://www.parasoft.com/wsdl/calculator/">
<soapenv:Header/>
<soapenv:Body>
<cal:add>
<cal:x>?</cal:x>
<cal:y>?</cal:y>
</cal:add>
</soapenv:Body>
</soapenv:Envelope>
This is my actual xml request which i need to fetch....
Hi! I wanted to ask if you figured out how to make the script work?
