cancel
Showing results for 
Search instead for 
Did you mean: 

Transfering all elements of the response into Excel

Contributor

Transfering all elements of the response into Excel

I found this code on the forum, but I'm not a java/groovy programer.

Can you help?

// get holder for response
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def holder = groovyUtils.getXmlHolder( "Test Request#Response" )

// select nodes
holder.namespaces["ns"] = "http://EB.telecom.co.nz/"
def nodes = holder.getDomNodes( "//nsSmiley TongueroductOfferingSummary" )

// create list of XML strings
def list = []

for( node in nodes )
{
  java.io.StringWriter writer = new java.io.StringWriter()
  com.eviware.soapui.support.xml.XmlUtils.serialize( node, writer )
  list.add( writer.toString() )
}

// some debug info..
log.info( list )
log.info( list.size() )

// store in context for later access
context.nodeList = list

---------------------------------------------------------------------------

Try changing the for loop to

for( node in nodes )
{
  def value = com.eviware.soapui.support.xml.XmlUtils.getNodeValue( node )
  list.add( value )
}

===========================================================================
My attempt follows:

// get holder for response
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def holder = groovyUtils.getXmlHolder( "Test Request#Response" )

// select nodes
holder.namespaces["ns"] = "http://twowire.com/services"
def nodes = holder.getDomNodes( "//ns1:getParameterNamesResponse" )

// create list of XML strings
def list = []

for( node in nodes )
{
  java.io.StringWriter writer = new java.io.StringWriter()
  com.eviware.soapui.support.xml.XmlUtils.serialize( node, writer )
  list.add( writer.toString() )
}

Fri Jun 13 14:12:35 MST 2008:ERROR:java.lang.NullPointerException
1 REPLY 1
Super Contributor

Re: Transfering all elements of the response into Excel

Hi,

The solution outlined in http://www.eviware.com/component/option ... 19#msg2419 should be applicable here.. makes sense?

regards!

/Ole
eviware.com
New Here?
Join us and watch the welcome video:
Top Kudoed Authors