Forum Discussion
Layansan
New Contributor
You need to use an Excel API to communicate or manipulate data in the Excel files.
Download Java Excel API and place the JXL.jar file in the “lib” folder of your SoupUI installation directory.
Assume the response is like:
<Response xmlns="http://localhost/something"> <content>some content</content> <id>100</id> </Response>
Add a Groovy test step
import jxl.* import jxl.write.* def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context ) def holder = groovyUtils.getXmlHolder("RequestStep#ResponseAsXml") // Change RequestStep name log.info holder.getXml() // will display /Log the response in Xml WritableWorkbook workbook = Workbook.createWorkbook(new File("C:/output.xls")) WritableSheet sheet = workbook.createSheet("Worksheet 1", 0) log.info(sheet.isHidden()) xPath1 = "//*:id/text()" // use xPath to access the value from response xPath2 = "//*:content/text()" log.info holder.getNodeValue(xPath1) log.info holder.getNodeValue(xPath2) Label label = new Label(0, 1, holder.getNodeValue(xPath1)); //column=0,row=1 sheet.addCell(label); Label label1 = new Label(2, 2, holder.getNodeValue(xPath2)); //column=2,row=2 sheet.addCell(label1); workbook.write(); workbook.close();
ddineesh
6 years agoNew Contributor
its working just fine for me. Thanks a lot for this article.
Related Content
- 5 years ago
- 4 years ago