Forum Discussion
- omatzuraSuper ContributorHi Kevin,
Exactly what do you want to store in the list? The XML-text of each ProductOfferingSummary? Or its corresponding DOM Element? or some value in the XML?
regards!
/Ole
eviware.com - Kevin_SladeContributorHi Ole
The intention is to store all of the returned data content, so that a decision can be made later based on the type of product offering. The type of product offering being used later will determine which type of data class overload will be needed in a subsequent SOAP call.
As you can see this relates the defect I raised that you are working on, SoapUI Pro Does not provide access to data classes that extend a base class.
Thank you for all of your valuable assistance.
Regards Kevin - omatzuraSuper ContributorHi!
ok.. hmm.. the following script will store the xml-string for each item:
// 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( "//ns:ProductOfferingSummary" )
// 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
Could this be a start?
regards!
/Ole
eviware.com - Kevin_SladeContributorHello Ole
As usual you have a great solution. I will implement this when I get into the office.
Many Thanks
Kevin - omatzuraSuper ContributorHi Kevin,
ok! Let me know how it works. The tricky bit might be to later parse these xml-strings to extract the desired values.. let me know if you need any help with this (or any other approach)!
regards,
/Ole
eviware.com - Kevin_SladeContributorHello Ole
The simple change to point to the test step that I need to analyse has allowed me to collect the xml into an array of lists.
Thank you very much.
If I need pointers on parsing the XML I will be sure to ask.
Thank you for your usual prompt and accurate replies. This is certainly helping the cause to get more licenses installed here.
Regards Kevin - omatzuraSuper ContributorHi Kevin,
well, that's definitely for a good cause :-)
regards!
/Ole
eviware.com - tmuldersOccasional ContributorHello,
I got basically the same problem. I receive an XML response with an array of Notifications. I need the id's of all Notifications and write them to a file so I can use it as a DataSource for other operations. Your groovy script gave me the id's within an xml string. Thats the problem, I dont need the XML string, I need the id's
Is there way to do it? Thanks in advance.
Kind Regards, - omatzuraSuper ContributorHi!
try changing the for loop to
for( node in nodes )
{
def value = com.eviware.soapui.support.xml.XmlUtils.getNodeValue( node )
list.add( value)
}
The list should now contain the text contents of the selected nodes..
Hope this helps!
regards,
/Ole
eviware.com
Related Content
- 9 years ago
Recent Discussions
- 5 days ago
- 10 days ago